[Machine Learning] Octave Basic Operations

You can do baisc math:

复制代码
5+6
32-8
1/2
2^3
1 == 2 % ans = 0 means false
1 ~=1 % 1 not equals to 2. ans = 1 means true
1 && 0
1 || 0
xor(1, 0)
复制代码

 

Change the output:

PS1('>> ')

 

Semicolon: 

If you don't use semicolon, it prints the output, if you add semicolon, it doesn't print output:

 

disp(a): print value:

a=pi;
disp(sprintf('2 decimals: %0.2f', a)) # 2 decimals: 3.14

 

Format:

 

 

Matrix / Vector:

 

Step increasment:

v = 1:0.2:2 # a row vector start from 1, each element increase by 0.2 until 2

 

if step is 1:

v = 1:6 # from 1 to 6

 

2by3 matrix with all 1:

复制代码
ones(2,3)

"""
ans =

   1   1   1
   1   1   1

"""
复制代码
复制代码
c = 2*ones(2,3)
"""

c =

   2   2   2

   2   2   2

"""
复制代码
w = zeros(1,3) 
w= rand(3,3) # uniform distribution between zero and one.
w = randn(3,3) # Gaussian distribution with mean zero and variance or standard deviation equal to one

 

More complex matrix:

w = -6 + sqrt(10)*(randn(1, 10000));
hist(w)
hist(w, 50)

 

posted @   Zhentiw  阅读(100)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2018-08-17 [React] Build a slide deck with mdx-deck using Markdown + React
2018-08-17 [React] Spread Component Props in JSX with React
2017-08-17 [React] Create component variations in React with styled-components and "extend"
2017-08-17 [React] Animate your user interface in React with styled-components and "keyframes"
2017-08-17 [Angular] Update FormArray with patchValue
2016-08-17 [Webpack] Use the Webpack Dashboard to Monitor Webpack Operations
2016-08-17 [RxJS] AsyncSubject
点击右上角即可分享
微信分享提示