MATLAB Commands and Syntax Examples, Study notes of Computer Science

Various examples of matlab commands and their corresponding output notes. It covers topics such as creating matrices, performing arithmetic operations, generating plots, and using functions. Students and researchers in engineering, physics, and mathematics may find this document useful for understanding the basics of matlab programming.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-owy-1
koofers-user-owy-1 🇺🇸

3

(1)

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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)
pf3

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)