Using the function xt e100t ut from t 0 to 02 s Wc3002pie F
Using the function x(t) = e^(-100t) *u(t) from t= 0 to 0.2 s
Wc=300*2*pie Fc= 300Hz Wo = 400*2*pie
Use numerical Method to calculate and plot |X(jw)| , |W(jw)| , |Y(jw)| , |F(jw)| with MATLAB
I\'m having trouble with one of the functions in the code, XW = CTFourierTransform(t,dt,xt,w) i am getting an error saying the function is undefined. The code I have is below.
clear all;
close all;
fc = 300;% fc=300Hz
f0 = 400;% f0=400Hz;
wc = 2*pi*fc;
w0 = 2*pi*f0;
dw = 0.2*pi;
fw = 800; % the maximum frequency 800 Hz is used for evaluation
ww = 2*pi*fw;
w = -ww:dw:ww;
dt = 0.0005;
t = 0:dt:0.2;
xt = exp(-100*t);
XW = CTFourierTransform(t,dt,xt,w); % Perform Fourier Transform for
% continuous-time signal
plot(w/(2*pi),abs(XW));
xtr = ICTFourierTransform(w,dw,XW,t);% Perform inverse Fourier
% Transform for continuous-time signal
figure;
hold on;
plot(t,xt,\'r\');
plot(t,real(xtr),\'b\');
hold off;
tic;
% Multiply xt by e^(j*wc*t) to get yt.
yt= exp(-100*t).*exp(1j*wc*t);
% Fourier transform yt to get YW.
YW=CTFourierTransform(t,dt,yt,w);
% Put YW throught the low-pass filter.
WW=YW;
% Compute for loop length ahead of time to decrease computation time.
WWlength=length(WW);
count = round(0.5*f0/fw*WWlength);
for x = 1:count
WW(x) = 0;
end
for y = 3*count:WWlength
WW(y) = 0;
end
% Bring WW into the time domain.
wt= ICTFourierTransform(w,dw,WW,t);
% Multiply wt by e^(-j*wc*t) to get ft.
ft= wt.*exp(-1j*wc*t);
% Bring ft into the frequency domain.
FW=CTFourierTransform(t,dt,ft,w);
% Finally create the graph.
figure
plot(w/(2*pi),abs(XW),\'r\');
hold on
plot(w/(2*pi),abs(YW),\'g\');
plot(w/(2*pi),abs(WW),\'b\');
plot(w/(2*pi),abs(FW),\'k\');
xlabel(\'f (Hz)\')
title(\'Signal Graph\')
legend(\'|X(jw)|\',\'|Y(jw)|\',\'|W(jw)|\',\'|F(jw)|\',\'Location\',\'Best\')
hold off;
% The task for the students is ended here,
time = toc;
fprintf(\'The running time is %6.4f seconds\ \',time)
Solution
Save CTFourierTransform function and ICTFourierTransform type script in your matlab so that the function will executes and gives you required results

