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

22 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Shivam Kumar Singh
Shivam Kumar Singh el 5 de Jul. de 2020
You can use fft() function in Matlab.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by