NSS Experiment 10 28
NSS Experiment 10 28
COs to be achieved:
CO5: Apply Fourier transform for spectral analysis
Theory:
A. Fourier transform
The Fourier transform of a function of time is a complex-valued function of frequency, whose
magnitude represents the amount of that frequency present in the original function, and whose
argument is the phase offset of the basic sinusoid in that frequency. The Fourier transform is
not limited to functions of time, but the domain of the original function is commonly referred
to as the time domain
+∞
x (t )= ∫ X ( F ) e
j 2 π Ft
dF
−∞
+∞
1
x (t)= ∫
2 π −∞
jΩt
X ( jΩ ) e dΩ since dΩ=2 πdF
Stepwise-Procedure:
Fourier Transform
A
1. Determine the Fourier transform of a rectangular pulse
2. Obtain the plot
clear all;
t=-2:0.1:2;
xct=(t>=-1)-(t>=1);
%plot (t,xct);
figure;
w=-8*pi:0.01:8*pi;
for i=1:length(w)
xcw(i)=trapz(t, xct.*exp(-1i*w(i).*t));
%xcw(i)=int(xct*exp(-1i*w(i).*t));
end;
%plot(w,(xcw));
%gridon;
subplot(2,2,1)
plot (t,xct);
xlabel ('Time');
ylabel ('Amplitude');
title('input signal');
subplot(2,2,2);
plot(w, (xcw));
xlabel ('frquency');
ylabel ('Mag Spectrum');
title('Fouier Transform');
%subplot(1,2,2);
B.
clear all;
% Parameters
a = 1; % Choose a value for 'a' (a > 0)
t = -2:0.1:2; % Time vector
xct = exp(-a * t) .* (t >= 0); % Define the function x(t) = e^(-at) * u(t)
% Frequency range
w = -8*pi:0.01:8*pi;
xcw = zeros(size(w)); % Initialize the Fourier transform array
% Plotting
figure;
subplot(2, 2, 1);
plot(t, xct);
xlabel('Time (t)');
ylabel('Amplitude');
title('Input Signal: x(t) = e^{-at} u(t)');
grid on;
subplot(2, 2, 2);
plot(w, abs(xcw)); % Plot magnitude of the Fourier Transform
xlabel('Frequency (w)');
ylabel('Magnitude Spectrum');
title('Fourier Transform |X(w)|');
grid on;
Observations
Fourier Transform (Rectangular pulse) and Input Function
Inverse
% Assume xcw has already been computed as per your provided code.
% Define a new time vector for the inverse transform
t_recon = -2:0.1:2; % same time vector as the original
subplot(2,2,3);
plot(t_recon, real(x_reconstructed));
xlabel('Time');
ylabel('Amplitude');
title('Reconstructed Signal');
Inverse
clear all;
% Parameters
a = 1; % Choose a value for 'a' (a > 0)
t = -2:0.1:2; % Time vector
xct = exp(-a * t) .* (t >= 0); % Define the function x(t) = e^(-at) * u(t)
% Frequency range
w = -8*pi:0.01:8*pi;
xcw = zeros(size(w)); % Initialize the Fourier transform array
% Plotting
figure;
Conclusion: