What do these lines mean?
1 view (last 30 days)
Show older comments
Hi there, I want to know what do these two lines mean :
[q,v] = max(10*log10(p));
And
[s,f,t,p] = spectrogram(y,100,80,100,Fs);
0 Comments
Answers (1)
Walter Roberson
on 25 Aug 2015
p is a vector or an array. log10(p) is logarithm base 10. Multiply that by 10. If the result is a vector, return the maximum value of the vector into q and return the location the maximum value was found at in v. If the result is an array, return the maximum value of each column into q and return the location of the maximum value in each column in v.
10*log10(x) is often used to calculate decibels.
Equivalent code would be
[maxp, v] = max(p);
q = 10*log10(maxp);
2 Comments
Walter Roberson
on 25 Aug 2015
Edited: Walter Roberson
on 25 Aug 2015
If you do not specify the dimension to work along and p is a 2D array, then [maxp, v] = max(p) would be equivalent to
for K = 1 : size(p,2)
[maxp(1,K), v(1,K)] = max(p(:,K));
end
That is, the maximum in each column.
I am not familiar with spectrogram() and I have to cut my lawn so I do not choose to study the topic at this time.
See Also
Categories
Find more on Time-Frequency Analysis 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!