Clear Filters
Clear Filters

how can i compute the inverse fourier transform of the heaviside function without use the ifft, if in this case i have the function in the frequency domain and one time vector and a frequency vector that I would like to plot my function?

2 views (last 30 days)
The code that I have is:
w0=15; %frequencia da fonte
w=linspace(1,150,150); %vetor da frequencia
t=linspace(-10,30,150); %vetor do tempo
alpha=0.1; %coeficiente de atenuação de sinal sísmico
% HEAVISIDE 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])
But, in my case, I don't have the function in time domain to compare. I have only the function in the frequency domain. I need help, please.

Answers (0)

Categories

Find more on Data Import and Network Parameters in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!