How to take FFT inside ode function ?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!