Presentation is loading. Please wait.

Presentation is loading. Please wait.

Script Files UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative.

Similar presentations


Presentation on theme: "Script Files UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative."— Presentation transcript:

1 Script Files UC Berkeley Fall 2004, E77 http://jagger.me.berkeley.edu/~pack/e77 Copyright 2005, Andy Packard. This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. http://jagger.me.berkeley.edu/~pack/e77http://creativecommons.org/licenses/by-sa/2.0/

2 Script Files Script files text files (created with a text editor) contain many lines of MATLAB expressions and assignments. You can execute all of the lines of the file (sequentially) by typing the filename at the MATLAB prompt. If filename is computetraj.m, then >> computetraj causes the instructions (ie., the MATLAB commands) in the file to be run.

3 Script file example Suppose a file called runthis.m contains the text X = linspace(0,4*pi,1000); Y = sin(3*X) + 2*cos(5*X); plot(X,Y) maxy = max(abs(Y)); disp([’Peak of Y is ’ num2str(maxy)]); Then, typing >> runthis will cause the 5 lines to execute, resulting in a plot and a message about the peak value of Y.


Download ppt "Script Files UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative."

Similar presentations


Ads by Google