How to take FFT inside ode function ?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Matlab is solving ode point by point in t . I want to take FFT inside the function myode. It can taken outside but the way I understand it it needs to be inputted point by point. Is it possible ?
options = odeset('RelTol',3e-14,'AbsTol',[3e-14 3e-14 3e-14 3e-14 3e-14 3e-14 ]);
[t1,x1] = ode45(@myode,[-tmax/2:dt:(tmax/2-dt)],Ni(1:end-1),options); % solve x
function dx=myode(t,x)
R = cos(a*t)
dx = R*x; example
Now I want to take FFT but the ode is calculated point by point.
function dx=myode(t,x)
R = cos(a*t)
t = -tmax/2:dt:(tmax/2-dt) ;
fr = -1/(2*dt):1/tmax:1/(2*dt)-1/tmax;
W1 = exp(1i*k1*z);
Y1 = fftshift(fft(R,resol));
Y1 = Y1.*W1;
y = (ifft(fftshift((Y1))));
dx = y*x; example
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!