I have a matlab question needs help. Write a MATLAB function which outputs L sam
ID: 2267395 • Letter: I
Question
I have a matlab question needs help. Write a MATLAB function which outputs L samples from a sinusoid of frequency f sampled at Fs. Generate 3 plots showing the generated samples for Fs = 48kHz, L = 100, and f = 2.3kHz, f = 23kHz, and f = 36kHz. Use the subplot() command to place all 3 plots in the same figure window. Label the horizontal and vertical axes of all plots and give titles for each plot with the value of f.
Task 1 (20%). Write a MATLAB function which outputs L samples from a sinusoid o frequency f sampled at Fs. Generate 3 plots showing the generated samples for Fs-48kHz, L-100, and f = 2.3kHz, f =23kHz, and f = 36kHz. Use the subplot() command to place all 3 plots in the same gure window. Label the horizontal and vertical axes of all plots and give titles for each plot with the value of f. Task 2 (20%). Use MATLAB's fft() function to find the length 64 Fast Fourier Transform of the signals generated in Task 1. Generate a figure with 3 plots corresponding to the magnitude of the FFT of each signal from Task I. Plot the irst half of the FFT with the horizontal axis scaled to be in units o rdians. Label the axes for each subplot and give titles for each figure to denote fExplanation / Answer
inthis code frequency is interms of kilo hertzs
function sampling_1
t=-100:0.01:100;
l=100;
fs=48;
f1=2.3;
f2=23;
f3=36;
fs1=2*f1;
fs2=2*f2;
fs3=2*f3;
n1=-4:1:4;
x=cos(2*pi*f1*t);
subplot(2,2,1);
plot(t,x);
xlabel('time in seconds');
ylabel('x(t) is interms of frequency');
title('continous time signal');
x1=cos(2*pi*n1*f1/fs1);
subplot(2,2,2);
plot(t,x1);
xlabel('time in seconds');
ylabel('x1(t)');
title('plot at f=2.3khz');
x=cos(2*pi*f2*t);
x2=cos(2*pi*n1*f2/fs2);
subplot(2,2,3);
plot(t,x2);
xlabel('time in seconds');
ylabel('x2(t)');
title('plot at f=23khz');
x=cos(2*pi*f1*t);
x3=cos(2*pi*n1*f3/fs3);
subplot(2,2,4);
plot(t,x3);
xlabel('time in seconds');
ylabel('x3(t)');
title('plot at f=36khz');
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.