solution ODE using IFFT

10 views (last 30 days)
naser
naser on 28 Aug 2014
Commented: Yu Jiang on 29 Aug 2014
Hello,
I want to solve one ordinary differential equation using inverse Fourier transform.
But when I compare with ode45 solver results are very bad,
would you please help me?
my equation is:
my code is:
clc
clear all
t=[0:1e-3:30];
ff=sin(t);
Fs=1/t(2);
Y = fft(ff);
NFFT=length(Y);
f1 = Fs/2*linspace(0,1,NFFT);
YY=Y;
for ii=1:length(f1);
f=f1(ii);
w=2*pi*f;
x(ii)=(-w^2+i*w+1)^-1*YY(ii);
end
figure(2)
plot(t,real(ifft(x)))
  1 Comment
Yu Jiang
Yu Jiang on 29 Aug 2014
In this line
x(ii)=(-w^2+i*w+1)^-1*YY(ii);
why do you have i*w, not w?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!