Lecture5 - Chapter 3 Programming with MATLAB Numerical...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 Programming with MATLAB
Background image of page 1

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

View Full DocumentRight Arrow Icon
Newton’s Second Law Euler’s method To obtain good accuracy, it is necessary to use many small steps Extremely laborious and time-consuming to implement by hand Numerical Solution 2 d 2 d v m c g dt dv v c mg dt dv m - = - = ) ( ) ( ) ( ) ( i 1 i 2 i d i 1 i t t t v m c g t v t v - - + = + +
Background image of page 2
M-Files: Scripts and Functions You can create and save code in text files using MATLAB Editor/Debugger or other text editors (called m-files since the ending must be .m) M-file is an ASCII text file similar to FORTRAN or C source codes ( computer programs) A script can be executed by typing the file name, or using the “run” command Difference between scripts and functions Difference between scripts and functions Scripts share variables with the main workspace Functions do not
Background image of page 3

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

View Full DocumentRight Arrow Icon
Script file – a series of MATLAB commands saved on a file, can be executed by typing the file name in the Command Window
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

Lecture5 - Chapter 3 Programming with MATLAB Numerical...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online