how to find FFT for pure sine wave in simulink?
11 views (last 30 days)
Show older comments
i would like to find FFT for pure sine wave in simulink without using FFT spectrum, is it possible?
0 Comments
Answers (1)
Hari
on 28 May 2025 at 7:56
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!
0 Comments
See Also
Categories
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!