SYNTAX - obtain [pxx ,f] vectors from periodogram(_ fs); <— Errors in user's current usage
Show older comments
QUESTION: How do I correctly use [pxx, f] = periodogram(y_soundsource_data,window,nfft, Fs);
I need the pxx and f vectors to be able to index to find maxima.
For context ... trying to get the PSD local maxima, for 3 specific frequency ranges. I want both the x-frequency values and the PSD-y values.
(This was my trial yesterday which was very wrong --->https://dsp.stackexchange.com/questions/56468/normalizing-vectors-to-be-the-same-size-to-retain-psd-data)
I sent an email to someone, and he said to use the [pxx, f]= periodogram(_ Fs) version of the periodogram call.
Where pxx= the PSD y value vector and f= the x values which correspond to the frequency values that match 1:1 to the pxx points
Matlab Documentation Says:

Undesired Behavior:
- When I do use [pxx, f] = periodogram(y_soundsource_data,window, nfft, Fs); a window maker pops up and it doesn't automatically plot or
calculate anything.
- Tried function call--> [pxx, f]=periodogram([],Fs); which should give the PSD-estimate with default values, but then, it caused an error.
Code
%% audioread .wav file
[y Fs]= audioread('100-daddy1.wav');
%% y=source signal
sourceFig=figure(1);
plot(y);
xlabel('milliseconds'); ylabel('amplitude'); title('spectrogram = voice source signal');
%% PSD - Power Spectral Density <-- peaks here should give formants
filterfcn=figure(2);
PSD=periodogram(y); %calculate the power spectral density of the source signal
plot(PSD);
ylabel('magnitude || intensity of signal'); xlabel('frequency in Hz'); title('PSD of Source');
xlim([0, .35*10^4]);
%% PSD with modified window <--- window is the same length as x
PSD_mod_window= periodogram(y, window);
figure(4);
plot(PSD_mod_window); % don't understand why a window pops up or how to use it. Thought window, was supposed to be a vector of length x?
%% [pxx,f] = periodogram(_,fs)
%fs is the fourth input to periodogram
% to use default values, do [], for preceding args
[pxx4, f]= periodogram( [], Fs);
disp(sizeof(pxx4));
disp(sizeof(f));
How do I correctly use [pxx, f] = periodogram(y_soundsource_data,window,nfft, Fs); ?
I need the pxx and f vectors to be able to index to find maxima.
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!