# 1 MATLAB MATLAB MATrix LABoratory 20 Cleve Moler

1 MATLAB MATLAB MATrix LABoratory 20 Cleve Moler LINPACK EISPACK FORTRAN MATLAB 1984 Little Moler Steve Bangert MathWorks MATLAB MATLAB C

1997 MATLAB5.0 5.1 5.2 1999 5.3 MATLAB 2 MATLAB 1 FFT 2

GUI 3 MATLAB 3 WAV wavread sound bmp gif pcx tif jpeg 4 SIMULINK COMM DSP SIGNAL 16 5 MATLAB

M EXE MATLAB API MATLAB FORTRAN C MATLAB 6 PDF HTML demo help help elfun help exp help simulink lookfor lookfor 4 fourier MATLAB 1 MATLAB 1 MATLAB

Cell Array Cell 1_2_1 Structure Array Structure 1_2_2 5 . 1. A=[1,2,3;4,5,6;7,8,9]

A= 1 2 3 4 5 6 7 8 9 (:) (:) (ROWS)) (COLUMNS)) A(:,2), 2 ans = 2 5 8 6

1 eye (m,n) eye (m) m*n m*m eye (3,4) eye (3) 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 2 zeros (m,n) zeros (m) m*n m*m zeros (3,4) zeros (3) 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 7 3 ones (m,n) ones (m) m*n m*m 1 ones (3,4) ones(3) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2. 1 d=eig (A) A

[v,d]=eig (A) A [v,d]=eig (A) 8 v= d= 0.2320 0.7858 0.4082 16.1168 0 0 0.5253 0.0868 -0.8165 0 -1.1168 0 0.8187 -0.6123 0.4082 0

0 0.0000 v (:,i) d (i,i) 2 det (A) A det (A) ans = 0 9 3 expm (A) A expm (A) ans = 1.0e+006 * 1.1189 1.3748 1.6307 2.5339 3.1134 3.6929 3.9489 4.8520 5.7552

4 inv (A) A inv (A) Warning: Matrix is close to singular or badly scaled.Results may be inaccurate. RCOND = 2.055969e-018. ans = 1.0e+016 * -0.4504 0.9007 -0.4504 0.9007 -1.8014 0.9007 -0.4504 0.9007 -0.4504 10 5 orth (A) A orth (A) ans = 0.2148 0.8872 0.5206 0.2496

0.8263 -0.3879 6 poly (A) A A poly (A) ans = 1.0000 -15.0000 -18.0000 -0.0000 A A r=[1,2,3]; p= poly (r) p= 1 -6 11 -6 7 rank (A) A r=rank (A) r = 2 11 3. +

* / . b=[1+2i;3+4i] b= 1.0000 + 2.0000i 3.0000 + 4.0000i b' ans = 1.0000 - 2.0000i 3.0000 - 4.0000i b.' ans = 1.0000 + 2.0000i 3.0000 + 4.0000i 12

4. 1 [q,r]=qr (A) A A=q*r q (unitary matrix), norm 1 r [q,r]=qr(A) q= -0.1231 0.9045 0.4082 -0.4924 0.3015 -0.8165 -0.8616 -0.3015 0.4082 r= -8.1240 -9.6011 -11.0782 0 0.9045 1.8091 0 0 -0.0000 norm(q) ans =

1.0000 13 2 [L,U]=lu (A) A A=L*U L lower triangular matrix U (upper triangular matrix) [L,U]=lu(A) L= 0.1429 1.0000 0 0.5714 0.5000 1.0000 1.0000 0 0

U= 7.0000 8.0000 9.0000 0 0.8571 1.7143 0 0 0.0000 14 0 1 4x^3+3x^2+2x+1 [4 3 2 1] 1. 1 conv z=conv (x,y) x=[1 3 5]; y=[2 4 6]; z=conv(x,y)

z= 2 10 28 38 30 15 conv x,y conv(conv(x,y),x) ans = 2 16 68 172 284 280 150 2 1 deconv [z,r]=deconv (x,y) x y z r [z,r]=deconv(z,x) z=

2 4 6 r= 0 0 0 0 0 16 3 roots fx=[1 3 2]; rootoffx=roots(fx) rootoffx = -2 -1 4 polyval (p,x) p x x p = [1 -6 11 -6] x=1; p1=polyval (p,x) p1 = 0 x=[1,2,3]; p2=polyval (p,x)

p2 = 0 0 0 17 x=A; p3=polyval (p,x) p3 = 0 0 0 6 24 60 120 210 336 5 polyder (p) p p=[1 -6 11 -6]; dp=polyder(p) dp = 3 -12 11 18

6 [r,p,k]=residue (x,y) x/y x,y , x/y x/y=r1/(s-p1)+r2/ (s-p2)+...+rn/ (s-pn)+ks residue x/(x^2+3x+2) x=[1 0]; y=[1 3 2]; [r,p,k]=residue(x,y) r= 2 -1 p= -2 -1 k= []

19 r,p,k ?[x,y]=residue(r,p,k) x= 1 0 y= 1 3 2 20 sym x=sym(x) a=sym(alpha) x, alpha

f=sym(a*x^2+b*x+c) f a, b, c, x syms syms a b c x sym f=sym (f(x)) f (x) 21 1. diff Diff (f, x, n) f x n 1). sin (ax), x a ?syms a x ?f=sin(a*x);

?df=diff(f,x) df = cos(a*x)*a ?dfa=diff(f,a) dfa = cos(a*x)*x 22 2 ?syms a x ?A=[-sin(a*x),sin(a*x);cos(a*x),cos(a*x)] A= [ -sin(a*x), sin(a*x)] [ cos(a*x), cos(a*x)] ?dy=diff(A,x) dy =

[ -cos(a*x)*a, cos(a*x)*a] [ -sin(a*x)*a, -sin(a*x)*a] 23 3 jacobian Jacobi ?syms r l f ?x=r*cos(l)*cos(f); ?y=r*cos(l)*sin(f); ?z=r*sin(l); ?J=jacobian([x;y;z],[r l f]) J= [ cos(l)*cos(f), -r*sin(l)*cos(f), -r*cos(l)*sin(f)] [ cos(l)*sin(f), -r*sin(l)*sin(f), r*cos(l)*cos(f)] [ sin(l), r*cos(l), 0 ]

24 2. int int (f, r, x0, x1) f r x0,x1 ?sym x; ?sym k real ?f=exp(-(k*x)^2) f= exp(-k^2*x^2) ?int(f,x,-inf,inf) ans = signum(k)/k*pi^(1/2) 25

3. ?syms k; ?s1=symsum(1/k^2,1,inf) s1 = 1/6*pi^2 26 4. limit limit lim f ( x ) Limit (f ), limit (f , x )

x 0 lim f ( x ) Limit (f , x , a) , limit (f , a ) x a lim f ( x ) Limit (f , x , a , left) x a lim f ( x ) Limit (f , x , a , right) x a

27 5. 1 collect (f ) 2 expand ( f ) 3 horner ( f ) 4 factor ( f ) 5 simplify ( f ) 28

2 2 f ( x) x sin x MATLAB Taylor 29 MATLAB 30 1 M Script File Function File . m 1 1 M

Script file MATLAB M MATLAB MATLAB Base workspace clear MATLAB 31 1 1 1 2 M

MATLAB M function MATLAB Function workspace MATLAB 32 1 2 1 3 M

M functio % lookfor help % % M 33 2 2 1 Local

Global global MATLAB 2 2 MATLAB [ 1, 2,] = ( 1, 2 , ) 34 2 2 3 MATLAB MATLAB nargin

nargout circle .m nargin am1.m nargout varargin varrgout evalin 35 2 3 MATLAB

2 3 1 MATLAB forend while---end ifelseend switch---case try---catch 2 3 2 return echo input pause keyboard break error warning 36 2 3 MATLAB

2 3 3 GUI MATLAB Callback Callback Callback M MATLAB Callback Callback Callback M MATLAB Callback Callback 37

2 4 M M Bug Syntax Run-time M 38 2 4 M 1

M M disp echo echo on M echo FunNsme on FunNsme M M keyboard keyboard M M M 39

## Recently Viewed Presentations

• Matt. 9:9-13, "And as Jesus passed forth from thence, he saw a man, named Matthew, sitting at the receipt of custom: and he saith unto him, Follow me.And he arose, and followed him. And it came to pass, as Jesus...
• Chapter 19: Continental Alkaline Magmatism Alkaline rocks occur in all tectonic environments, including the ocean basins Conversely, Chapters 12, 15, 17, and 18 have shown us that magmatism on the continents can be highly varied, including tholeiitic and calc-alkaline varieties
• Adds to the picture of the stroke subtype . TACI, PACI, LACI, POCI, haemorrhage. Trial recruitment. Communication when referring to other teams. eg. neurointervention, neurosurgery. Facilitates communication to patients and families / care givers.
• Britain Takes Over: British North America 1763-1867 Governing the colonies At first, the British didn't really 'shake things up'. After the fall of Quebec in 1759, the status quo, or the same standard the French had been used to was...
• GhazalMimi Khalvati. To discuss the imagery and structure of the poem. To learn the meaning of a Ghazal. Ghazal. In Middle Eastern and Indian literature and music, a poem with a fixed number of verses and a repeated rhyme, typically...
• Utilizing CBMS in Monitoring and Targeting the Poor: The case of Barangay Kemdeng, San Vicente, Palawan A CBMS Philippines Research Paper prepared for the PEP Network Meeting
• "The reach of man after the Absolute Reality." ... You might even ask how I got such a privilege. Yet, we are invited to open up our hearts to the Creator and Ruler of the universe! Oh, what a privilege...
• Leaders: Locke, Montesquieu, Rousseau, Voltaire. American (1776) and French Revolutions (1789) inspired by Enlightenment. Abolitionists working to end slavery. Latin America was aware of these ideas/revolts and sought to free itself of Spanish/Portuguese control