Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Include Page
MATLAB Google Analytics
MATLAB Google Analytics
Include Page
Spring-Mass System - Panel
Spring-Mass System - Panel

Step 4: Function Creation

Let's separate out the Euler's method in its own function. This makes our code modular. Anytime we want to perform an Euler integration, say, for different time steps, we can just call the function. Follow the steps in the video below to create this function.

Wiki Markup
{html} <iframe width="600" height="338" src="//www.youtube.com/embed/8YVxQWTpDNQ?rel=0" frameborder="0" allowfullscreen></iframe> {html}


We use the debugger to step into the function and understand the execution flow and how variables are handled in a function. A very important take away is that variables created within a function are local to that function and go away when the function call is completed. Only the values passed back to the calling function are retained.

Wiki Markup
{html} <iframe width="600" height="338" src="//www.youtube.com/embed/MeWjGPDc2Rw?rel=0" frameborder="0" allowfullscreen></iframe> {html}



Go to Step 5: Structure Creation

Go to all MATLAB Learning Modules