solution ODE using IFFT
9 views (last 30 days)
Show older comments
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
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations 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!