Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For sections with repetitive actions in the code below use a loop. You can submit more than one solution. You can use while or for
For sections with repetitive actions in the code below use a loop. You can submit more than one solution. You can use while or for etc THE LANGUAGE IS (( MATLAB ))
%% Discrete signal with a sampling frequency of 10 Hz
fa=10;
ta=1/fa;
t1=0:ta:10-ta;
xa=2+6*cos(2*pi*10*t1)+cos(2*pi*20*t1);
%% Discrete signal with a sampling frequency of 15 Hz
fb=15;
tb=1/fb;
t2=0:tb:10-tb;
xb=2+6*cos(2*pi*10*t2)+cos(2*pi*20*t2);
%% Discrete signal with a sampling frequency of 20 Hz
fc=20;
tc=1/fc;
t3=0:tc:10-tc;
xc=2+6*cos(2*pi*10*t3)+cos(2*pi*20*t3);
%% Discrete signal with a sampling frequency of 40 Hz
fd=40;
td=1/fd;
t4=0:td:10-td;
xd=2+6*cos(2*pi*10*t4)+cos(2*pi*20*t4);
%% Discrete signal with a sampling frequency of 60 Hz
fe=60;
te=1/fe;
t5=0:te:10-te;
xe=2+6*cos(2*pi*10*t5)+cos(2*pi*20*t5);
%% A tiledlayout to plot the original signal and the discrete signals continously
tiledlayout(3,2);
% Each plot has the same axis boundaries and y and x labels but differe from the others in the title and what is plotted on the x and y axis
nexttile
plot (t,x)
title('fs=300');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
plot (t1,xa)
title('fs=10');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
plot (t2,xb)
title('fs=15');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
plot (t3,xc)
title('fs=20');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
plot (t4,xd)
title('fs=40');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
plot (t5,xe)
title('fs=60');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
%% A tiledlayout to plot the original signal and the discrete signals as stems
tiledlayout(3,2);
% Each stem has the same y and x labels but differe
% from the others in the title and what is plotted on the x and y axis.All the stems has the same axis boundaries except for the one original signal as we need shorter x axis to view it in a better way.
nexttile
stem (t,x)
title('fs=300');
axis ([0 0.2 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
stem (t1,xa)
title('fs=10');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
stem (t2,xb)
title('fs=15');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
stem (t3,xc)
title('fs=20');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
stem (t4,xd)
title('fs=40');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
nexttile
stem (t5,xe)
title('fs=60');
axis ([0 1 -4 10]);
xlabel ('time(t)')
ylabel ('Amplitude')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started