function out=fsamples(choice) % FSAMPLES(CHOICE) Demonstrates how to use the proce- % dures FAPP, FOURCOEFFS, FOURPOL, etc. % % CHOICE is an integer that controls which example % will be shown. If CHOICE < 1 then all examples will % be shown. More commonly, one may want to edit this % file and play same example w/ different parameters. % % 1 step. 2 saw. 3 abs(sin). 4 hat. 5 (hat w/ brim). % % All rights reserved: Matthias Kawski, September 30, 2000. % Contact: kawski@asu.edu, http://math.la.asu.edu/~kawski if nargin < 1 choice = 0 end if choice == 1 | choice < 1 clf xx=[0:0.01:2]; [yy,c,xx]=fapp('step',xx,10,min(xx),max(xx),'real'); c bar(c) pause plot(xx,yy,'b') hold on fplot('step',[0 2],'r') pause end if choice == 2 | choice < 1 clf xx=[0:0.01:2]; [yy,c,xx]=fapp('saw',xx,10,min(xx),max(xx),'real'); bar(c) pause plot(xx,yy,'b') hold on fplot('saw',[0 2],'r') pause end if choice == 3 | choice < 1 clf xx=[0:0.01:pi]; [yy,c,xx]=fapp('sin',xx,3,min(xx),max(xx),'real'); bar(c) pause plot(xx,yy,'b') plot(xx+pi,yy,'b') hold on plot(xx,abs(sin(xx)),'r') pause end if choice == 4 | choice < 1 clf xx=[0:0.01:1]; [yy,c,xx]=fapp('hat',xx,3,min(xx),max(xx),'real'); bar(c) pause plot(xx,yy,'b') hold on plot(xx+1,hat(xx),'m') fplot('hat',[0,1],'r') plot(xx+1,yy,'b') axis([0 2 -1/5 3/5]) pause end if choice == 5 | choice < 1 clf c=fourcoeffs('myfun',5,-2,2,[],'real') xx=[-6:0.02:6]; yy=fourpol(xx,c,4,'real') bar(c) pause plot(xx,yy,'b') hold on plot(xx,myfun(xx),'r') axis([-6 6 -1/5 6/5]) pause end