Docsity

MATLAB Commands and Syntax Examples, Study notes of Computer Science

Partial preview of the text

Download MATLAB Commands and Syntax Examples and more Study notes Computer Science in PDF only on Docsity!

The Hot List

command action

ls

doc

clear

ans

pi

Inf

grid on

help function name

lookfor keyword

whos

cd

pwd

doc function name

NaN

eps

plot( xlist, ylist)

legend(' text', 'text')

title(' text' )

xlabel(' text')

ylabel(' text ')

axis([ xmin xmax ymin ymax])

gtext(' text ')

length( vectorname)

size( matrixname )

save filename

load filename

disp( varname )

Commands Output Notes

A = [1 2 3; 4 5 6; 7 8 9] a = 10 sin(a) format long sin(a) a = [1 2 3] b = [1; 2; 3] c = [1 2 3]' A = ones(5) B = ones (5,1) C = ones(1,5) A = eye(4) B = rand(6,2) C = zeros(2,5) a = 1: b = 1:0.5: c = linspace(1,10,3) A = ones(3,3) B = 2ones(3,3) C = AB D = inv(A)B A = ones(3,3) b = rand(3,1) c = rand(1,3) Ab Ac A = 2ones(3,2) B = [1 2; 3 4; 5 6] AB A.B A = [1 2 3; 4 5 6; 7 8 9] B = A(2,3) C = A(1:2, 1:3) D = A(5,5) A(5,5) = pi A = 2*ones(4) A^ A.^ A = [1 2 3; 4 5 6; 7 8 9] A(:) A = [1 2 3; 4 5 6; 7 8 9] a = [1 2 3] sum(A,1) sum(A,2) sum(a)