1. Consider a pulse function of time duration –T/2 to +T/2 with amplitude (A). P
ID: 1940348 • Letter: 1
Question
1. Consider a pulse function of time duration –T/2 to +T/2 with amplitude (A).Plot the magnitude of the Fourier transform versus frequency (Hz) for T = 1 and A = 1 using the exponential form as well as the sin form on the same plot. Plot from -15 to +15 Hz.
2. Using the same frequency spectrum as above, plot the magnitude of F(f) for the two pulses: A = 1 and T = 1 (as above) and A = 10 and T = 0.1 on the same graph.
(I have posted this question TWICE. So you can get the points twice). I just need the matlab code.
Thank you
Explanation / Answer
close all
clear all
%computation of Fourier transform of a pulse
a= 0.5; %Pulse of width a
A= 1; %Pulse Amplitude]
h= 1; %Stepsize
aT=1*a;
T=-0.5:h:aT;
om=-15:0.2:15;
%defining the pulse function
pa=zeros(1,length(T));
for k=1:length(T)
t=(k-1)*h+T(1);
if abs(t) <= a
pa(k)=A;
end
end
%defining an auxiliary string of ones
uv=ones(length(pa),1);
%rapid computation of the sum
for j=1:length(om)
omt=om(j);
Ft(j)=(pa.*cos(omt*T))*uv*h;
end
figure
plot(om,Ft)
title('Fourier Transform of a Pulse')
xlabel('Frequency (rad/sec)')
ylabel('Magnitude of Fourier Transform')
%%
%computation of Fourier transform of a pulse
a= 0.5; %Pulse of width a
A= 1; %Pulse Amplitude]
h= 1; %Stepsize
aT=1*a;
T=-0.5:h:aT;
om=-15:0.2:15;
%defining the pulse function
pa=zeros(1,length(T));
for k=1:length(T)
t=(k-1)*h+T(1);
if abs(t) <= a
pa(k)=A;
end
end
%defining an auxiliary string of ones
uv=ones(length(pa),1);
%rapid computation of the sum
for j=1:length(om)
omt=om(j);
Ft(j)=(pa.*cos(omt*T))*uv*h;
end
figure
hold on
plot(om,Ft)
title('Fourier Transform of a Pulse')
xlabel('Frequency (rad/sec)')
ylabel('Magnitude of Fourier Transform')
%computation of Fourier transform of a pulse
a= 1; %Pulse of width a
A= 1; %Pulse Amplitude]
h= 1; %Stepsize
aT=0.1*a;
T=-0.5:h:aT;
om=-15:0.2:15;
%defining the pulse function
pa=zeros(1,length(T));
for k=1:length(T)
t=(k-1)*h+T(1);
if abs(t) <= a
pa(k)=A;
end
end
%defining an auxiliary string of ones
uv=ones(length(pa),1);
%rapid computation of the sum
for j=1:length(om)
omt=om(j);
Ft(j)=(pa.*cos(omt*T))*uv*h;
end
plot(om,Ft)
title('Fourier Transform of a Pulse')
xlabel('Frequency (rad/sec)')
ylabel('Magnitude of Fourier Transform')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.