필터 지우기
필터 지우기

How can I calculate the inverse fourier transform in matlab?

조회 수: 12 (최근 30일)
Hi. I have to calculate the inverse fourier transform of the function F in may code and compare with the original function f. The code is
w0=15; %frequencia da fonte
w=linspace(1,150,150); %vetor da frequencia
deltaw=w(2)-w(1);
t=linspace(0,30,150); %vetor do tempo
alpha=0.1; %coeficiente de atenuação de sinal sísmico
for nt=1:length(t)
if t(nt)>=0.0
H(nt)=1.0; %H(t) é a função de Heaviside
end
if t(nt)<0.0
H(nt)=0.0;
end
f(nt)=H(nt)*(exp(1)^(-alpha*t(nt)))*sin((pi/180)*w0*t(nt));
end
for nw=1:length(w)
F(nw)=alpha/(alpha^(2)+(w(nw)+(pi/180)*w0)^(2));
end
A=(i*t'*w);
B=exp(A);
Ftempo=(1/(2*pi))*deltaw*(F*B.');
plot(t,f,t,real(Ftempo))
But the graphic is not good. What I have to do?
  댓글 수: 1
Youssef  Khmou
Youssef Khmou 2013년 3월 11일
i tried to change your code , but i do not understand the lines : "A=i*t'*w);......"

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

채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 3월 11일
편집: Youssef Khmou 2013년 3월 11일
hi Marcia,
Are you trying to compute the inverse Fourier Transform of the Heaviside function and compare it with Heaviside function?
you can try this code in which Fast Fourier Transform is computed using loops not built in fft function :
w0=15; %frequencia da fonte
w=linspace(1,150,150); %vetor da frequencia
deltaw=w(2)-w(1);
t=linspace(-10,30,150); %vetor do tempo
alpha=0.1; %coeficiente de atenuação de sinal sísmico
% HEAVIVISE FUNCTION H, F(H)=z and F^1(z)=ZZ
for nt=1:length(t)
if t(nt)<0.0
H(nt)=0.00; %H(t) é a função de Heaviside
elseif t(nt)==0
H(nt)=0.5;
elseif t(nt)>0.0
H(nt)=1.00;
end
end
figure, plot(t,H,'LineWidth',1.9), axis([-10 30 -1 2]), title(' Heaviside function H(x)'), grid on ,
% Fourier Transform, without using FFT
N=length(H);
nfft=N;
z=zeros(1,nfft);
Sum=0;
for k=1:nfft
for jj=1:N
Sum=Sum+H(jj)*exp(-2*pi*j*(jj-1)*(k-1)/nfft);
end
z(k)=Sum;
Sum=0;% Reset
end
figure, plot(w, abs(z),'LineWidth',1.9), title(' Fourier Transform of F[H(x)]'), grid on
% Inverse FOURIER Transform
ZZ=zeros(1,nfft);
Sum=0;
for k=1:nfft
for jj=1:N
Sum=Sum+z(jj)*exp(2*pi*j*(jj-1)*(k-1)/nfft);
end
ZZ(k)=Sum;
Sum=0;% Reset
end
ZZ=ZZ/N;
figure, plot(t, real(ZZ),'LineWidth',1.9), title(' Inverse Fourier Transform F^{-1}[F[H(x)]]=H(x)'), grid on
axis([-10 30 -1 2])
  댓글 수: 1
Marcia Azeredo
Marcia Azeredo 2013년 3월 12일
Yes. This is what I would like to do. Thanks. I'l test this code.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by