What do these lines mean?

조회 수: 8 (최근 30일)
Mohamed Nedal
Mohamed Nedal 2015년 8월 25일
편집: Walter Roberson 2015년 8월 25일
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);

답변 (1개)

Walter Roberson
Walter Roberson 2015년 8월 25일
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
Mohamed Nedal
Mohamed Nedal 2015년 8월 25일
@Walter Robertson: Thank you very much for your answer. I have a couple of questions please :
1. You said that 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. DO you mean return the location of the maximum value in each "row" in v or in each "colum" ?
2. What about the command line ?
[s,f,t,p] = spectrogram(y,100,80,100,Fs);
Walter Roberson
Walter Roberson 2015년 8월 25일
편집: Walter Roberson 2015년 8월 25일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Hilbert and Walsh-Hadamard Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by