フィルターのクリア

How to create a Frequency Spectrum plot from nonlinear equations

3 ビュー (過去 30 日間)
PetronasAMG
PetronasAMG 2021 年 9 月 24 日
回答済み: Pratyush 2024 年 5 月 21 日
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!

回答 (1 件)

Pratyush
Pratyush 2024 年 5 月 21 日
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.

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by