How to convert a square wave to frequency domain in Matlab or simulink

13 次查看(过去 30 天)
Hi all,
I am so grateful, if you can give me some hints and advice for this issue.
I read a analog signal from my Arduino which is a square wave signal. I would like to obtain the frequency of this signal to do further control work. However, I do not know how to obtain it.
(1) I found some models with FFT function in simulink, but the input signal is DSP sine wave signal in these models. If I replace the input signal (DSP sine wave) with the square wave obtained from Arduino, these models will not work.
(2) If I do it in Matlab rather than Simulink, which fuction is valid in this case? And how can I convert the continuous signal in to frequency domain (or just get the value of the frequency) in Matlab?

采纳的回答

Shivam Kumar Singh
You can use fft() function in Matlab.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by