1 / 21

Matlab 101

Matlab 101. For Beginners. Overview. The Matlab Environment Vectors Matrices Plotting and Graphics Statistics Basic Calculus. The Matlab Environment. Vectors. Inputting vectors: >> a = [4,5,7,8] %% a(2) = 5 Common operations Transpose of a >> a’ =

prue
Download Presentation

Matlab 101

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matlab 101 For Beginners

  2. Overview • The Matlab Environment • Vectors • Matrices • Plotting and Graphics • Statistics • Basic Calculus

  3. The Matlab Environment

  4. Vectors • Inputting vectors: >> a = [4,5,7,8] %% a(2) = 5 • Common operations • Transpose of a >> a’ = • Adding components >> sum(a) = 24

  5. Vector Arithmetic • >> a = [5,0]; • >> b = [3,4]; • Find magnitude of a • >> X = a.*a • >> Y = sum(X) • >> mag = sqrt(Y) • Find angle between a and b using • a.b = |a||b|cos(Ө)

  6. Matrices • >> A = [1,-2,1; 3,4,5; -2,1,7] • A = • rank(A) • Inv(A) • Det(A)

  7. Matrix Arithmetic • Solve the linear system using matlab • X-2Y+Z=12; 3X+4Y+5Z=20; -2X+Y+7Z=11 • Ax=B: A = B = • >> C = inv(A) • >>x = C*B • X = A\B

  8. Plotting and Graphics • Plot the graph of cos(x) for 0<x<10 • x=[0:0.1:10]

  9. Plotting and Graphics • >> x = [0:0.1:10]; • >> y = cos(x); • >>plot(x,y),xlabel('x'),ylabel('cos(x)')

  10. Graph of cos(x) and sin(x)

  11. Table of colors

  12. Statistics • Differential Equations grades for Final Exam

  13. Statistics • X = [95, 90, 85, 80, 75, 70, 65, 60, 55, 50,0]; • Y = [1,2,1,6,4,7,2,1,3,2,4]; • bar(x,y)

  14. Intro to Programming

  15. bar3 function %%bar3(X,Y)

  16. Basic Calculus • Finding limits: find

  17. Basic Calculus • Draw and find

  18. Solving differential equations • Derivative of f >> diff(f) • nthderivative of f >> diff(f,n) • >> D2y +2*Dy=5*sin(7*x) • Solve the above equation with

  19. pretty function

  20. The End

More Related