Fourier transform of impulse function

조회 수: 35 (최근 30일)
friet
friet 2017년 2월 28일
댓글: Hira Asghar 2018년 2월 25일
I calculated the Fourier transform of a pulse function(figure 1) Using the fft function. However The fft result if kind of weird. Can anyone check if my code is right. //Thanks
clc
clear all
close all
t1=7.0e-08;
sigma=1e-08;
t=linspace(0,4.0000e-7,1000);
P=exp(-(t-t1).^2./sigma.^2);
P_FT=fft(P); %fourier transform of P
figure(1)
plot(t*10^6,P);
grid on
xlabel('time[\mus]')
ylabel('amplitude[a.u]')
figure(2)
plot(P_FT);
grid on
  댓글 수: 1
Hira Asghar
Hira Asghar 2018년 2월 25일
Can u explain your signal 'p'?

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2017년 2월 28일
편집: Star Strider 2017년 2월 28일
The Fourier transform of an impulse function is uniformly 1 over all frequencies from -Inf to +Inf. You did not calculate an impulse function.
You calculated some sort of exponential function that will appear as an exponential function in the Fourier transform.
Your slightly modified code:
t1=7.0e-08;
sigma=1e-08;
L = 1000;
t=linspace(0,4.0000e-7,L);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
P=exp(-(t-t1).^2./sigma.^2);
P_FT=fft(P)/L; %fourier transform of P
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(t*1E+6, P);
grid on
xlabel('time[\mus]')
ylabel('amplitude[a.u]')
figure(2)
plot(Fv, abs(P_FT(Iv))*2);
grid on
The correct representation of the Fourier transform of your signal is in figure(2).
  댓글 수: 2
friet
friet 2017년 2월 28일
편집: friet 2017년 2월 28일
Hi Star Strider! Thanks for your answer. I understand it now. I have further question. I have a function which is frequency and space dependent and I post my question a week ago here https://www.mathworks.com/matlabcentral/answers/326466-fourier-transform-space-dependent-function however, didnt get any answer. With your help today I get closer to solve my problem however, can't makes it to the final answer. Can u please help me to compute the space and frequency dependent function. I have tried the following code.
clc
clear all
close all
t1=7.0e-08;
sigma=1e-08;
L = 1000;
t=linspace(0,4.0000e-7,L);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
P=exp(-(t-t1).^2./sigma.^2);
P_FT=fft(P)/L; %fourier transform of P
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(P_FT(Iv))*2);
grid on
xlabel('f[Hz]')
ylabel('amplitude[a.u]')
%................................................
z=linspace(0,2*10^-3,1000); %[m]
v=2000;
alpha= 5; %[Neper/cm]
beta=(2*pi*Fv/v); %[Hz]
figure(3)
plot(Fv*10^-6,beta*0.01)
xlabel('f[MHz]')
ylabel('alpha[N/cm]')
pfz=zeros(length(z),length(Fv));
pft=zeros(length(z),length(Fv));
for j_f=1:length(Fv)
for i_z=length(z)
pfz(i_z,j_f)=P_FT(j_f).*exp(-alpha.*z(i_z)).*exp(1i.*beta(j_f).*z(i_z));
end
end
for i=length(z)
pft(i,:)=ifft(pfz(i,:));
end
figure(4)
plot(z,abs(pft))
Star Strider
Star Strider 2017년 2월 28일
I answered you in the email you sent. The essence of that being that you can use Laplace transforms to solve partial differential equations in time-domain and space-domain by converting them to ordinary differential equations in s-domain and space-domain. That is relatively straightforward with Laplace transforms but much more difficult with Fourier transforms, since they can involve complex frequency variables. Those are much more difficult to work with.
I do not understand the problem you want to solve.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 2월 28일
plot() with one argument that is complex-valued (hint!) plots real() of the parameter against imag() of the parameter.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by