Normalizing vectors to be the same size to retain PSD data
1 view (last 30 days)
Show older comments
Context: PSD=periodogram(y) in MATLAB gives the PSD (power spectral density) estimate of a sound-source signal. I want to find the local maximum within 3 different x ranges of PSD.
How do I make a vector that maps 1:1 to the PSD -y value vector?The x values that MATLAB generates are Hz - frequency values, so I don't want to change the values per se, but create a vector that goes from x=0:3500, but have the same number of elements as the PSD vector, PSD= 32769*1 double.
How do I do this while retaining the same data?
PSD plot. acquired with plot(PSD) <-- x values generated by MATLAB
%% F1 range
subset1=zeros(1, 601); %create a vector to store PSD values within the range of interest
for x=200:800;
subset1(x)=PSD(x);% input in the values of interest
end
F1=max(subset1);% find the max value within the range
%PROBLEM: wanted to find the x value which corresponded to the max y <-- but this actually is the max y value
%PROBLEM: x vector not the same size as PSD values within the range, so many points not considered.
disp(F1);
%% F2 range
subset2=zeros(1, 1001);
for x=800:1800;
subset2(x)=PSD(x);
end
F2=max(subset2);
disp(F2);
%% F3 range
subset3=zeros(1, 1701);
for x=1800:3500;
subset3(x)=PSD(x);
end
F3=max(subset3);
disp(F3);
0 Comments
Answers (0)
See Also
Categories
Find more on Parametric 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!