Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Click save as - and name the file "main_function" - the same as the function's name. Now, open up bending_stress.m and copy the entire code. Paste it below the main function. Close both functions with an "end" What you have now should look like this:

Now, try running main_function in the command window. The result should be the same plot you saw when you rain beam3 and beam5.

That brings us to the end of this tour. Before we part, let's remind ourselves of some important programming guidelines that we have followed in this tour:

  • Develop code incrementally, testing obsessively at each stage. Develop a plan for how you are going to build your code before you sit at the computer.
  • Dig through the MATLAB help diligently to figure out how to use specific functions etc. Usually, the examples are the best place to start. This is a better strategy than desperately hunting for the TA every time you need help with your code.
  • Comment your program liberally.

In addition to this tutorial, there are several other references to use when learning Matlab. This link here will take you to Mathworks' video tutorials for Matlab.