MatLab Lesson 1
MatLab Lesson 1
clearvars
% Clear command Window, clc clears all the text from the Command Window, resulting in a clear
screen. After running clc, you cannot use the scroll bar in the Command Window to see
previously displayed text. x’ % x transpose
clc
you = 25, me = 10
every element.
B=zeros(2,8)
clc, clearvars
y = [12 50 -8 -100]
y.^2
clc, clearvars
A = [ 5 3 4.2; 5 9 88]
A (2,3) % to call the value for matrix A for the 2nd row and the 3rd col
clc, clearvars
nd
row
clc, clearvars
A = [ 5 3 4.2; 5 9 88]
nd
col
Exercise [MaxVal, I] = max(y) %return the index of max value
Answer
clc, clearvars
y= (-(x-3).^2) + 10 %
x=linspace(0,5);
y= @(x) (-(x-3).^2) + 10
y(20.2)
max (y)
min(y)