Using ifft correctly in MATLAB

5 views (last 30 days)
Jaimin Jha
Jaimin Jha on 5 Apr 2017
Hi,
I am trying to match the functions in Fourier transform table, i.e. I am plotting one function, then I use the standard transform of that function, take the ifft and try to match with original time domain function. But, the results don't match. I also tried using ifftshift command, but that also does not help. Can you please help me out with this? For reference I am attaching my code here.
clc; clear all; close all; %% sigma=5; t=0:1:100; f1=exp((-t.^2)/(2*(sigma^2)));
%%
N=2^8; f2=zeros(1,N-1);w=zeros(1,N-1);
for n=1:1:N-1; w(n)=2*pi*n/N; f2(n)=sigma*(sqrt(2*pi))*exp(-((sigma^2)*(w(n)^2))/2);
end f3=sigma*(sqrt(2*pi)); f4=[f3 f2]; f5=ifft(ifftshift(f4)); %% figure(1) subplot(2,1,1), plot(t,f1) subplot(2,1,2), plot(1/(N):100/(N):100,f4)

Answers (0)

Categories

Find more on Fourier Analysis and Filtering 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!