Versions Compared

Key

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

...

Include Page
SIMULATION: Intro Learning Module - Panel
SIMULATION: Intro Learning Module - Panel

Plot σx vs. ri

Calculate σx at O

Essentially, we need to repeat our previous calculation of σx at O for a range of rivalues. One way to do this is to loop over the previous calculation. There are two types of loops: for and while. Let's check the documentation to see what MATLAB provides for loops. Enter for loop in the search bar and then select for which is the first entry up top. Look at the first example. This shows the format of the for loop. You can often speed up the execution of MATLAB code by replacing for and while loops with vectorized code. That is what we'll do in Step 4. Let's stick it out with slowpoke for loop for now.

...

Now that we have spot checked our result, add a semi-colon after the sigma_x statement to avoid cluttering up the output.

Plot σx vs. ri

Let's pick MATLAB's brain on how to make a plot.

...