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)