Just study machine learning on
Coursera, so we could do some exercise.
- Download Octave from Octave
- Install the Octave
- Use Octave to do some simple calculation
Simple calculation:
1 + 2 2 - 1 3 * 2 5 / 8 2^6 1 == 2 % false = 0 1 ~= 2 % true = 1 1 && 0 % AND 1 || 0 % OR xor(1,0) % ans = 1 PS1('>> ') % just show ">>"
Variable:
a = 3 a = 3; % semicolon suppress the output b = 'hi'; b % output b = hi a = pi; a % output "a = 3.1416" disp(a) % output "a = 3.1416" disp(sprintf('2 decimals: %0.2f', a)) % output "2 decimals: 3.14" format long a % a = 3.14159265358979 format short a % a = 3.1416
Matrix and vector:
A = [1 2; 3 4; 5 6] v = [1; 2; 3] v = 1:0.1:2 v = 1:6 w = ones(2,3) w = rand(1,3) randn(1,10000) % Guassian hist(w) % histogram I = eye(4) help eye/rand/help