how to find FFT for pure sine wave in simulink?

조회 수: 6 (최근 30일)
swarnalakshmi N
swarnalakshmi N 2017년 3월 18일
답변: Hari 2025년 5월 28일
i would like to find FFT for pure sine wave in simulink without using FFT spectrum, is it possible?

답변 (1개)

Hari
Hari 2025년 5월 28일
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!

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by