reagrding fft when ode45 is involved

is there any special procedure to find frequency using fft if the input to fft function is the set of values which is the result of ode45.
that is.. i find x from ode45("func",tspan,x0)
fft(x(:,1),nfft).

Answers (1)

I am not certain I understand what you mean by ‘find frequency’. To use the fft function, your ‘tspan’ variable must be supplied as a vector of equally-spaced times from beginning to end (rather than a range of beginning and end times only), with the interval equal to a sampling interval Ts, that you would define.
For example:
Ts = 0.1;
Tstart = 0;
Tend = 10;
tspan = [Tstart:Ts:Tend];
The time returned by the ODE solver will be the same as the ‘tspan’ you specify. You can then take the fft of the other ‘x’ output of the ODE solver. See the documentation for fft to understand how to determine the frequencies of the results of the fft function.

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Asked:

on 14 Jan 2015

Answered:

on 14 Jan 2015

Community Treasure Hunt

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

Start Hunting!