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.


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.



Go to Step 5: Structure Creation

Go to all MATLAB Learning Modules

  • No labels