Structure plans, Live Scripts, and first Physics Example
Sept 13, 2019
A structure plan is basically an outline of the procedure you will use to solve the problem your code is designed to solve. The procedure the computer will follow is often called the algorithm.
A structure plan is often written in pseudocode. Pseudocode is short phrases for your outline in English, math, and/or equations. You should be able to undersand pseudocode without knowing MatLab.
We will often start one step above that. We will often solve a physics problem first--usually to get the equation we want to use in the program. Then we write the pseudocode. Sometimes you might iterate the pseudocode into more detail. Then the program.
The book gives an example in Section 2.3.8
Let's do some physics!
Let's start with free fall in 1D and work up to 2D motion with air resistance and friction.
I have a separate handout that will guide you through that.
At some point, I'll ask you to prompt the user for an initial velocity. Here's an example of what that might look like:
% ask for initial velocity, make a default value in case
prompt = 'What is the initial velocity in m/s (+=up) ? ';