EXAMPLE Matlab Help

Plotting with a for Loop

Write a script file to plot the function:

Capture

Solution

We choose a spacing dx = 35/300 to obtain 301 points, which is sufficient to obtain a smooth plot. The script file is the following:

Capture

Note that we must use the index k to refer to x within the loop, as x (k ).

Posted on July 30, 2015 in An Overview of MATLAB

Share the Story

Back to Top
Share This