Saturday 23 May 2015

Machine Learning Course 5 Study Log (Matlab)

1:
A = 1;
A == 1;
A = B;
1 && 0
xor(0, 1)
b = 'hi';
c = ( 3 > 1);
disp(sprinf('%0.2f',a));
format short/long
A = [2 3; 4 5];
A = [0:0.1:1];
A = ones(2,3);
A = zeros(2,3);
A = rand(2,3); %uniform
A = randn(2,3); %normally distributed random numbers
A = eye(2,3); %identity matrix

2:
size()
length()
pwd
ls
load or importdata
who or whos
clear
A = B(1:2)
A = B(1:2,:)
A(:,2)
A(:,[1 2])
A(:,[1:1:3])
A(1:2,:) = [1; 2]
C = [A; B]
C = [A B] or [A, B]
save 'text.txt' A - ascii
save 'text.mat' A %binary format

3:
log(A) or abs(A)
A + 2
A * 2 or A .* 2
-A
A * B
A .* B
(A)'
pinv(A)
A < 3
find(A < 3)
sum(sum(A))
prod(A)
floor , ceil
max(rand(3), rand(3))
max(A, [], 1)
A(:)
flipud

4:
plot()
plot(x,y,'r')
hold on;
xlabel
ylabel
legend
title
print -dpng 'test.png'
figure(1) %define which figure to use
subplot(1, 2, 1) % cut the plot into 1 * 2 and then use 1
imagesc, colorbar, colormap gray

5:
for i in 1:0.1:10
  XXX
end

break;
continue;

while i < 10
  XXX
end

if
elseif
elseif
else
end

function [y1, y2] = a_function_name(x)
   y1 = x^2
   y2 = x^3


search path; addpath ('')

6:












7.


No comments:

Post a Comment