Clear Filters
Clear Filters

How to create a Frequency Spectrum plot from nonlinear equations

9 views (last 30 days)
given three nonlinear equations
dx1/dt = 3(x1+x2)
dx2/dt = x1 - (1/6)x2
dx3/dt = (1/7) + (x1 -3.25)*x3
and their correspoding initial condtion x1(0) = 0, x2(0) = 4 and x3(0) = 0, I able to obtain t,x from using ODE 45, but after that I am quiet lost how to create a frequency spectrum from using the three nonlinear equations. please help! Seems like all the output from equation are non-unifrom therefore, interpolation has to be invovled but not sure how to do it. Please help with through explanations!

Answers (1)

Pratyush on 21 May 2024 at 5:23
Hello PetronasAMG,
To create a frequency spectrum from the solutions of nonlinear differential equations solved using `ode45` in MATLAB, follow these steps:
Interpolate the non-uniform output from "ode45" onto a uniform time grid.
  • Use "interp1" to interpolate the solutions ("x1", "x2", "x3") onto a new uniform time grid.
Compute the Fast Fourier Transform (FFT) of the interpolated signals.
  • Use "fft" to compute the FFT of each interpolated signal.
  • Calculate the single-sided spectrum from the double-sided spectrum obtained from the FFT.
Plot the Frequency Spectrum to visualize the frequency content.
  • Plot the magnitude of the FFT versus frequency for each signal.
This process involves interpolating the original, non-uniformly spaced solutions to create uniformly spaced data, which is then used to compute and visualize the frequency spectrum through FFT.


Find more on Fourier Analysis and Filtering 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!