Professional Documents
Culture Documents
ECE105
ECE105 Homework 5
Sections: Momentum & Kinetic Energy Plots; Plot SCC; More 2d Plot Types; 3d Plot Types
Submission type:
• sections 1a, 1b, 2, 3: write separate scripts, publish to pdf, upload to Canvas
• sections 4-5: work by hand, take scan/photo of work, upload to Canvas
Points: 20
The structure of the script should be as follows. Use comments to define units and explain
tricky steps.
2
Cody Anderson
ECE105
3
Cody Anderson
ECE105
The starting script below provides some large clues. Begin with this and make edits/additions as
needed. Note that this example script provides a blue letter outline, when it should be black.
Publish your script as a pdf (should display the full SCC plot).
4
Cody Anderson
ECE105
Looking at the plot, in the year 1810, approximately what is the U.S. population?
Can you be very precise with this estimate? Why not?
Enter the commands above into the Command Window. Then answer the questions.
What does the figure command accomplish?
5
Cody Anderson
ECE105
Why is it advantageous to plot data with a large range of values on a logarithmic axis?
Would it make sense to use a logarithmic x-axis for this example? Why or why not?
The U.S. population appears to have a near-perfect exponential growth through year 1890
(straight line on the semilog plot). Make a conjecture as to why this tapers off in the last
century:
Plot gallery
Perform an internet search for “types of MATLAB plots”. Select the Mathworks link.
How many different plot types are shown?
What is the difference between a bar plot and a barh plot?
6
Cody Anderson
ECE105
There are two classes of 3-dimensional plots to be aware of now: line plots and surface plots.
Here, t is the independent variable. Both x and y are computed as a function of t. In other
words, for every one value of t (let’s choose t = 10), there is a corresponding value for x (.055)
as well as for y (.123). Put these together and you have an ordered triplet which describes the
top point in the plot as (x, y, t) = (.055, .123, 10).
To give this plot a physical meaning, we could use it as a model for a spring’s position as a
function of time. We flick the spring at t = 0 seconds and monitor it until t = 10 s. At first the
vibrations both side-to-side (x position) and up-and-down (y position) are large, but as time
goes on they get smaller.
In a script, replicate the 5 commands given above. Run the script.
What does the command grid on accomplish?
Add commands to the script which will add in the three axis labels shown in the figure above.
Edit script line 4 so that the plot line has a width of 3.
Increase t’s step size to 1. Run the script. Describe what happens to the plot and explain why.
There are three types of 3d surface plots: contour, mesh, and surface. They have two
independent variables and one dependent variable.
In a script, replicate the given commands to create the example surface plot.
Write the contents of vector x:
Write the contents of vector y:
Write the contents of matrix x_grid:
x_grid and y_grid are the same size. Explain why this is important for script line 16.
• (0, 2, ____)
• (3, 5, ____)
• (____, 11, 44)
• (____, _____, 72)
Do each of the ordered triplets satisfy the governing equation z(x,y) = x2*y ?