{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

matlab_cheatshee

# matlab_cheatshee - MIT OpenCourseWare http/ocw.mit.edu...

This preview shows pages 1–2. Sign up to view the full content.

MIT OpenCourseWare http://ocw.mit.edu 18.085 Computational Science and Engineering I Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
A Matlab Cheat-sheet (MIT 18.06, Fall 2007) Basics: save 'file.mat' save variables to file.mat load 'file.mat' load variables from file.mat diary on record input/output to file diary diary off stop recording whos list all variables currenly defined clear delete/undefine all variables help command quick help on a given command doc command extensive help on a given command Defining/changing variables: x = 3 define variable x to be 3 x = [1 2 3] set x to the 1 × 3 row-vector (1,2,3) x = [1 2 3]; same, but don't echo x to output x = [1;2;3] set x to the 3 × 1 column-vector (1,2,3) A = [1 2 3 4;5 6 7 8;9 10 11 12]; set A to the 3 × 4 matrix with rows 1,2,3,4 etc. x(2) = 7 change x from (1,2,3) to (1,7,3) A(2,1) = 0 change A 2,1 from 5 to 0 Arithmetic and functions of numbers: 3*4, 7+4, 2-6 8/3 multiply, add, subtract, and divide numbers 3^7, 3^(8+2i) compute 3 to the 7th power, or 3 to the 8+2 i power sqrt(-5) compute the square root of –5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}