Notice! This document is currently in Archived status.
The content of this document may be incorrect or out dated.

Professor Bourman's Matlab Tutorial

M FILES



example1.m                      (file name)
--------------------

x=1:5;

y=2.^x;

plot(x,y)




%TYPE


>> example1

image


*Same as typing in directly


FUNCTIONS


  • Fourier Series expansion for sawtooth wave

term.m (file name) -------------------- function y=term(t,k) y=(2/pi)*(-1)^(k+1); y=y/k; y=y.*sin(k*pi*t);



>> t=-2:0.05:2; >> y1=term(t,1); >> y2=term(t,2); >> plot(t,y1,t,y2) image


example2.m (file name) -------------------- t=-2:0.05:2; y=0*t; for k=1:10 y=y+term(t,k); end plot(t,y)



>> example2 image >> print (prints to printer) >> print sawtooth.ps -dps (dumps postscript)

Last modified: 2007/03/20 17:12:16.078000 GMT-4 by Unknown
Created: 2007/03/20 17:12:16.078000 GMT-4 by brian.r.brinegar.1.

Categories

Search

Type in a few keywords describing what information you are looking for in the text box below.

Admin Options: Edit this Document