How to find fft for a system of two variables? Can you check my code if it is right, please?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function aaa
b= 3;
[t,x]=ode45(@DoubleSpeciesSystem, 0:0.01:10000 , [30 6] , [] , b);
n = length(x);
h=0.01;
dt = t(end)/(n-1);
Fs=1/dt;
NFFT=n;
y=fft(x,NFFT)/n;
f=linspace(0,1,NFFT/2+1)*(Fs/4);
Pow = abs(y(1:NFFT/2 +1)).^2; % Power of the DFT
Pow(1) = 0;
figure(1) % Plot single-sided amplitude spectrum.
plot(f,Pow)
1;
%function dxdt = DoubleSpeciesSystem(t,x,b)
%x(1) = prey
% x(2) = predator
%dxdt(1) = 15 * x(1) - b * x(1).* x(2);
%dxdt(2) = -5 * x(2) + 0.5 * x(1).* x(2);
%dxdt = [dxdt(1) dxdt(2)]';
%end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!