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

Your third course assignment involves numerical implementation of the Fourier tr

ID: 2083292 • Letter: Y

Question

Your third course assignment involves numerical implementation of the Fourier transform of continuous-time signals and inverse Fourier transform. The Fourier transform of a continuous-time signal x(t) is given by the following relation: X(j omega) = integral^infinity_-infinity x(t) e^-j omega t dt Also, the relation for the inverse Fourier transform is as follows: x(t) = 1/2 pi integral^infinity_-infinity X(j omega) e^j omega t d omega You will write two MATLAB functions: contft () that numerically computes the Fourier transform X(j omega) of a continuous-time signal x(t). The function should take as input a vector of time points t, a vector of signal values x and a vector of frequency points, omega. The output of the function should be the transform values X. The function should also plot the magnitude and the phase spectrum against the frequency omega. icontft() that numerically computes the inverse Fourier transform x(t) of X(j omega). The function should take as input a vector of frequency points omega, a vector of transform values X and a vector of time points t. The output of the function should be the vector of signal values x. The function should plot the time-domain signal x against the time vector t. Exercise: Use the function contft () to plot the CTFT of: x_1(t) = u(t + 4) - u(t - 4) and x_2(t) = sin pi/3 t/pi t (b) Use the transform results of the two signals given above in exercise (a) and the inverse FT function icontft () to plot the inverse Fourier transforms. Deliverables: submit your code and colored plots corresponding to the two exercises above. Note that this is an individual assignment. Each student should work alone on the assignment; the assignment; and submitted work will be subject to individual testing and viva-voce. The due

Explanation / Answer


function [a] = contft(t,x,w)

%x = input('Enter the input sequence = ');
N = length(x);
len = length(w)
for k = 1:len
y(k) = 0;
for n = 1:N
y(k) = y(k)+x(n)*exp(-1i*2*pi*(k-1)*(n-1)/N);
end
end
%code block to plot the input sequence
t = 0:N-1;
subplot(2,2,1);
plot(t,x);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('Input Sequence');
grid on;
magnitude = abs(y); % Find the magnitudes of individual FFT points
disp('FFT Sequence = ');
disp(magnitude);
%code block to plot the FFT sequence
t = 0:N-1;
subplot(2,2,2);
plot(w,magnitude);
ylabel('Amplitude ---->');
xlabel('K ---->');
title('FFT Sequence');
grid on;

clc
clear all
close all

t = 0:0.01:5;
x = cos(2*pi*5*t);
w = 1:1:1000;
contft(t,x,w);