Worcester Polytechnic Institute

Walsh Approximation

Home

Google

Online Materials

Contact Us

Site Map

 

Here is the M-File for the Walsh Approximation.  Right click on the link and go to save target as.  Save the file to the desktop and open it from Matlab.  We have been executing functions in the command window, it is much more efficient to create and M-File. To create an M-File, click file, new, M-File.  The file can be easily modified and then executed by pressing F5 or opening the Debug heading and clicking on Save and Run.  Every time you run the file all of the entries are carried out in the command window.  After you have the walsh.m file open, run it and two plots will appear.  One plot will be of the sine wave and the other the approximation. 

 

Go back into the M-File and change the range of n in the line for n =1:15; If a value higher than 15 is entered then the approximation becomes more exact and the opposite for a value less than 15.  Now you can see the ease of modification using M-Files.  Just for your information M-Files can be modified using notepad in case Matlab is unavailable and you wish to edit some work.

 

Return to Matlab Tutorial.

 

 

 

 

 

[WPI]