Reputation:
let us consider following code
>> B=xlsread('data_generations1','A1','g8:g301');
>> [pxx,f]=periodogram(B,[],[],100);
>> [peaks,location]=findpeaks(pxx);
>> [sorted_peaks,i]=sort(peaks,'descend');
>> stem(sorted_peaks)
>> plot(location,peaks)
>> plot(f,pxx)
>>
my aim is that also arrange frequencies according to sorted peaks, i have sorted it descending,so my goal that at first place should be frequencies at which maximum of sorted_peak is occurred and so on,so how can i manage it?thanks in advance
EDITED: is that correct way?
>> freq=f(location);
>> freq(i)
Upvotes: 0
Views: 100
Reputation: 245
As far as I understood,
location(i)
would give you the sorted order of the matching peaks.
So
sorted_locations = locations(i)
plot(sorted_locations, sorted_peaks)
would give you the matching plot.
Upvotes: 1
Reputation: 38032
As far as I can see, your edit would indeed be the correct way:
>> freq_peaks = f(location);
>> sorted_freq_peaks = freq_peaks (i);
Upvotes: 1