Asked by Kobi
on 7 Jul 2016

as you can see in my code, i made a fft of a simple signal but when i try to reconstruct it using ifft i can only see it in the ABS way, meaning that the ifft that i made is incorrect, please let me know what i did wrong

clear all

close all

clc

Ts=0.001;

t=0:Ts:10;

omega1=2*pi*15;

omega2=2*pi*40;

x=sin(omega1*t)+sin(omega2*t);

figure(1)

subplot(4,1,1)

plot(t,x)

grid on

xlim([0 0.1*pi])

title('\bf x=sin(\omega_1t)+sin(\omega_2t)')

xlabel('t[sec]')

ylabel('x(t)')

X_dft=fftshift(fft(x))/length(x);

Fs=1/Ts;

f=linspace(-Fs/2,Fs/2,length(t));

subplot(4,1,2)

plot(f,abs(X_dft))

grid on

xlim([-60 60])

title('\bf |Fourrier(x)|')

xlabel('f[Hz]')

ylabel('|X(f)|')

subplot(4,1,3)

X_phase=angle(X_dft);

plot(f,X_phase)

grid on

xlim([-60 60])

title('\bf Phase(x)')

xlabel('f[Hz]')

ylabel('Angle (\theta) [Radians]')

subplot(4,1,4)

x_ifft=abs(ifft(X_dft))*length(x);

plot(t,x_ifft)

grid on

xlim([0 0.1*pi])

title('\bf |x=sin(\omega_1t)+sin(\omega_2t)|')

xlabel('t[sec]')

ylabel('|x(t)|')

Opportunities for recent engineering grads.

Apply Today
## 5 Comments

## Adam (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/294122-how-to-make-inverse-fourrier-transform-in-the-correct-way#comment_377803

## Kobi (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/294122-how-to-make-inverse-fourrier-transform-in-the-correct-way#comment_377806

## Adam (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/294122-how-to-make-inverse-fourrier-transform-in-the-correct-way#comment_377807

## Kobi (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/294122-how-to-make-inverse-fourrier-transform-in-the-correct-way#comment_377936

## Adam (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/294122-how-to-make-inverse-fourrier-transform-in-the-correct-way#comment_378022

Sign in to comment.