MATLAB Tutorial. Dmitry Drutskoy Some material borrowed from the departmental MATLAB info session by Philippe Rigollet Kevin Wayne. Overview. Getting MATLAB set up Scalar/matrix creation and operations MATLAB programming Plotting. Installation.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
MATLAB Tutorial
Dmitry Drutskoy
Some material borrowed from the departmental MATLAB info session by
Philippe Rigollet
Kevin Wayne
A = [1 2 3; 4 5 6]; makes
A = [1,2,3;4,5,6]; or [1 2 3
4 5 6]
if A = [1, 2, 3; 4, 5, 6] then A′ = [1, 4; 2, 5; 3, 6]
A = [0:5:20]’; makes
A = A(:, 2) gives 2nd column
A(1:2, 3:4) gives 1-2 row, 3-4 column submatrix
Starting row is 1, ending row can be end. Can use stride here too, but not very useful.
[1, 2, 3]. *[2, 1, 2] = [2, 2, 6]
columns of A.
find([1, 2, 3] > 1) returns [2, 3]
save filename x y A
load filename
function [ output_args ] = Silly( input_args )
%SILLY Summary of this function goes here
% Detailed explanation goes here
end
if (a > 1)
blah
else
blahblah
end
for i=1:n
moreblah
end
function [ output1, output2 ] = Silly( input1, input2)
some_value= input1*input2;
output1 = some_value;
output2 = 15.7;
end
[a, b] = Silly(5, 7);
[a, b] = Silly(vector1, vector2);
y = (y1, . . . , yn) at the points x = (x1, . . . , xn).
hold on
plot (x1, y1, ':bo')
plot (x2, y2, '-r.')
hold off