how to find FFT for pure sine wave in simulink?

5 visualizzazioni (ultimi 30 giorni)
swarnalakshmi N
swarnalakshmi N il 18 Mar 2017
Risposto: Hari il 28 Mag 2025
i would like to find FFT for pure sine wave in simulink without using FFT spectrum, is it possible?

Risposte (1)

Hari
Hari il 28 Mag 2025
Hi Swarnalakshmi,
I understand that you want to compute the Fast Fourier Transform (FFT) of a pure sine wave in Simulink without using the “FFT Spectrum” block.
In order to find the FFT for a pure sine wave in Simulink without using the “FFT Spectrum” block, you can follow the below steps:
Generate the Sine Wave:
Use the “Sine Wave” block in Simulink to create a pure sine wave signal. Configure the frequency, amplitude, and sample time according to your requirements.
Buffer the Signal:
Use the “Buffer” block to collect a sequence of samples over a specified frame size. This is necessary because FFT operates on a block of data rather than a continuous stream.
Implement FFT Logic:
Use the “MATLAB Function” block to write a custom function that takes the buffered data as input and computes the FFT using MATLAB’s “fft” function.
function Y = computeFFT(u)
Y = fft(u); % Compute FFT
end
Calculate Magnitude:
Use the “Abs” block to calculate the magnitude of the FFT output. This gives the amplitude spectrum of the signal.
Visualize the Spectrum:
Use the “Scope” block to visualize the amplitude spectrum. Ensure the x-axis represents frequency by configuring the simulation parameters appropriately.
Refer to the documentation of “fft” function to know more about its usage:
Hope this helps!

Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by