MATLAB Answers

Find the frequency at maximum value in pwelch function

24 views (last 30 days)
no nitro
no nitro on 16 Sep 2018
Answered: Aquatris on 17 Sep 2018
I plotted my pwelch, and I want the frequency at which the graph shows the highest value. In this particular case its around .25. I tried using findpeaks but it gives me some weird answer.

  1 Comment

dpb on 16 Sep 2018
"... findpeaks but it gives me some weird answer"
Show your work; findpeaks should have no problem with that input signal with suitable inputs...

Sign in to comment.

Answers (1)

Aquatris on 17 Sep 2018
You can obtain the frequency and power vectors from pwelch function. Example;
fs = 1e3;
t = 0:1/fs:1-1/fs;
x = sin(2*pi*100*t);
[pxx,f] = pwelch(x,500,300,500,fs);
then, you can simple do the following to find the frequency corresponding to max peak;
index = find(pxx == max(pxx));
freq_max = f(index); % frequency at which pxx is maximum


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by