Using MATLAB Create a set of four stem plots, each stem plot on its own set of a
ID: 675109 • Letter: U
Question
Using MATLAB Create a set of four stem plots, each stem plot on its own set of axes, but with all stem
plots in a single figure. Use the subplot function. The four stem plots are:
upper left corner of figure: sampled sine-wave with w= 2*pi/16
upper right corner of figure: sampled sine-wave with w = 2*pi/8
lower left corner of figure: sampled cosine-wave with w= 2*pi/16
lower right corner of figure: sampled cosine-wave with w = 2*pi/8
If done correctly, your figure should contain four stem plots arranged in 2 rows and 2
columns.
You should have a unique title associated with each stem subplot. You don’t need x-axis
labels or y-axis labels for this problem.
Use a line width of 2 points for all lines.
Explanation / Answer
close all;
clear all;
t = -15:01:15;
y=sin(2*pi/16*t);
subplot(2,2,1);
stem(t,y,'k','linewidth',2);
title('Sine Waveform 2*pi/16.', 'fontsize',12);
grid on;
set(gca,'YTick',[-1 0 1]);
y=sin(2*pi/8*t);
subplot(2,2,2);
stem(t,y,'k','linewidth',2);
title('Sine Waveform 2*pi/8.', 'fontsize',12);
grid on;
set(gca,'YTick',[-1 0 1]);
y=cos(2*pi/16*t);
subplot(2,2,3);
stem(t,y,'k','linewidth',2);
title('Cosine Waveform 2*pi/16.', 'fontsize',12);
grid on;
set(gca,'YTick',[-1 0 1]);
y=cos(2*pi/8*t);
subplot(2,2,4);
stem(t,y,'k','linewidth',2);
title('Cosine Waveform 2*pi/8.', 'fontsize',12);
grid on;
set(gca,'YTick',[-1 0 1])
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.