How do I call the dsp toolbox "peak finder" from code?

1 view (last 30 days)
Hi all,
In dsp toolbox, I created a "SpectrumAnalyzer" system object to monitor the frequency spectrum of my microphone input in real-time. Although I can detect the peak frequencies by "tool menu -> peak finder", I want to use a code to return the peak frequencies directly in the script or command window for further process. Is it possible to do that?
Many thanks, T
  3 Comments
Tianqi Xu
Tianqi Xu on 15 Nov 2016
Thank you for your reply! Actually, I have already checked that page before posting the question, but have trouble implementing it to my case. How do I convert the signal in the time domain (audio streaming from the microphone) into the frequency domain in real-time? Doing a FFT is one way, but it is too much computation for real-time audio processing. I hope I can make use of the built-in peak finder so that no extra computation is needed.
Tianqi Xu
Tianqi Xu on 15 Nov 2016
Thank you for your help! After trial and error, I think I still need to go with the findpeak() function. For future references, this page may also be helpful to d the FFT to the signal in time domain. https://www.mathworks.com/help/matlab/examples/fft-for-spectral-analysis.html

Sign in to comment.

Answers (1)

Puneet Rana
Puneet Rana on 23 Feb 2017
Hi Tianqi,
You can run findpeaks on the result of dsp.SpectrumEstimator .

Community Treasure Hunt

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

Start Hunting!