Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please do a, b, c: A continuous time signal is defined as: x(t) = 2 cos(200pi*t)

ID: 2268197 • Letter: P

Question

Please do a, b, c:

A continuous time signal is defined as: x(t) = 2 cos(200pi*t) + 3 sin(600pi*t) + cos(1200pi*t)

a) Use MATLAB’s fft function to compute the 1024-point fft of the sampled signal and plot the absolute value.

b) Simulate passing the signal through a low pass filter by making the upper 512 points of the computed fft equal to zero. Plot this new filtered signal.

c) Use MATLAB’s ifft function to compute the 1024-point ifft of the filtered signal. This is your recovered signal from the samples after passing through a low pass filter. Plot the absolute value of this computed signal.

Here is the matlab code and plot for signal x(t):

t=0:0.1:(10*pi);
x=(2*cos(200*pi*t))+(3*sin(600*pi*t))+(cos(1200*pi*t));
plot(t,x)
grid on
title('waveform of x(t)')
xlabel('time in seconds ');
ylabel('output value of x(t) for given time ');

Explanation / Answer

%For the given x(t) the sampling frequency is not enough so we use a little bit different x(t) with same shape

%A)

fs = 4000% sampling frequency
t=0:1/fs:0.3;
x=(2*cos(200*pi*t))+(3*sin(600*pi*t))+(cos(1200*pi*t));% creation of signal
DFT = fft(x, 1024);%1024 pt FFT
f= (1:1:1024)*200/26;% scaling of frequency for display on plot

figure(1);
plot(f,abs(DFT)*3/length(x));
title('Waveform of DFT(x(t))')
xlabel('Frequency in Hz ');
ylabel('Magnitude');


%B) has 2 answers
% if you want a LPF we must use
%DFT(120:1024-120) = 0;
% but according to the given question
DFT(512:1024) = 0;

figure(2);
plot(f,abs(DFT)*3/length(x));
title('Waveform of DFT(x(t)) after LPF')
xlabel('Frequency in Hz ');
ylabel('Magnitude');
% for 1024 DFT of the signal we see 200hz occur at 26, 600 hz at 78 and
% 1200 Hz at 155 with magntudes in the ratio 2:3:1
%Removing the top 512 elements from the FFT wont make it work like a Low
%Pass Filter hence we will remove values from 120 to 904 to remove 1200Hz
%frequency component


%C)Ploting of ifft
out = abs(ifft(DFT,1024));
figure(3);
plot(out)
title('waveform of x(t)')
xlabel('time in seconds ');
ylabel('output value of x(t) for given time ');