EENG 1910: Project I Introduction to Electrical Engineering
Assignment-9
To copy the resulting figures in the problems below to Word,
Click Edit on the figure window, then Copy Figure and paste into
your Word document.
Problem-1: Plotting in Different Figure Windows
Plot sin(x) for x values ranging from 0 to 2? (use the linspace
function or column operator) in two separate figure windows (Use
figure(1), figure(2))
– using 10 points in this range – using 100 points in this range
Annotate your figures and provide an explanation of the
difference observed in the two figures.
Problem-2: Subplot
Use subplot to show the difference between the sin and cos
functions. Create an x vector with 100 linearly spaced points in
the range from 2? to 2?, and then two y vectors (y1 and y2) for
sin(x) and cos(x). In a 2×1 subplot, use the plot function to
display them, with appropriate titles.
Problem-3: Plotting, Labelling, Hold On/Off
Plot ?? = exp(??) in the interval [-3, 3] using a solid line. Now
plot a linear approximation of ???? (i.e. ?? = ??) using a dashed line with a square marker in a different color and a quadratic
approximation of ???? (i.e. ?? = 1 + ?? + ??2
2 ) using a dotted line and a
circle marker in another color. Title the plot Plots of
Approximations of exp(??). Label the y-axis as Approximations
of exp(??) and the x-axis as ??. Use legend to appropriately identify the plotted lines. Set axes limits to [-3, 3, -5, 15].
Note: Make sure to define ?? with sufficient data points to avoid obtaining choppy curves. Use hold on/hold off to obtain the
three curves on the same figure.
Problem-4: Bar Chart, Histogram, Subplot
Let the vector
Grades = [68, 83, 61, 100, 80, 95, 45, 100, 70, 75, 82, 57, 5,
76, 85, 62, 71, 96, 78, 76, 68, 72, 75, 83, 87, 89, 99, 93, 100,
100, 80, 96, 100, 98, 45, 96, 89, 86, 99, 90, 70]
represent the distribution of final grades in an engineering
course.
a. Use MATLAB to sort (sort) the grades. Then, using the subplot
function subdivide the figure window into two rows and one
column that shows the following:
Recent Comments