MATLAB/Cookbook

From Wikiversity
Jump to navigation Jump to search

The intent of this cookbook is to provide the user with code that can be copied and pasted directly into MATLAB, and then modified to serve the user's needs. As you contribute recipes, please keep your code as simple as possible by following the following rules:

  • do the simplest task you can imagine that teaches the concept. Remember that once the user gets the basic idea, he/she can go to MathWorks for more details.
  • avoid duplicating what is already available on the internet
  • DON'T FORGET TO TEST YOUR CODE!
  1. caseStructure is the first 'recipe' you need because it introduces the structure of all the other 'recipes'. The case structure is used to subdivide the code into small "snippets" for the user to copy/paste/modify.
  2. plot2D a sample 2D plotting code for you to run and modify. It also works on GNU Octave. See also this subplot.
  3. symbolicIntegration shows how to calculate and plot integrals. See also http://www.mathworks.com/help/symbolic/create-plots.html
  4. Ordinary differential equations
  5. plot3D: z=f(x,t)/

We are in need of the following recipes[edit]

Before writing, you should research what information is readily available elsewhere.

  1. Matrix (array) algebra should cover mulitplication, division, inverse, and transpose.
  2. Matrix (array) indexing how to write, modify arrays and also how to reserve space for large arrays in order to make the code run faster.
  3. Input and output Needs writing. How to read and write using either the command window or files.
  4. Linear interpolation Needs writing. See wikipedia:Linear interpolation. Phy2400 @ WSU-L is working on this project.
  5. for and while loops Needs writing.
  6. sound Needs writing.
  7. animated gifs
  8. Fourier analysis Covering FFT, series, and integral transforms might require as many as three pages....then there is the Laplace transform
  9. Matlab GUIs
  10. Vector decomposition in matlab