0
Matlab에서 피크 수를 찾으려고합니다. 주어진 임계 값에 따라 주어진 wav 파일을 플로팅 할 때 두 개의 뚜렷한 피크가 있음을 쉽게 볼 수 있습니다. 그러나 화면에 "두 개의 피크가 있습니다"라고 쓰려면 어떻게해야합니까? 내 첫 시도는 다음과 같습니다.MATLAB에서 피크 수 결정
hfile = 'two.wav';
[stereo1, Fs, nbits, readinfo] = wavread(hfile);
mono1 = mean(stereo1,2);
M = round(0.01*Fs);
N = 2^nextpow2(4*M);
w = gausswin(M);
[S,F,T,P] = spectrogram(mono1,w,120,N,Fs);
thresh_l=1000;
thresh_h=10000000;
% take the segment of P relating to your frequencies of interest
P2 = P(F>thresh_l&F<thresh_h,:);
%show the mean power in that band over time
m = mean(P2);
[pks,loc]=findpeaks(T,'npeaks',m);
message = sprintf('The number of peaks found = %d',length(pks));
msgbox(message);
어디에서 원하니? 플롯 자체에 메모 나 팝업으로 나타나는 msgbox에서? – jerad
둘 다 좋습니다. 이 메시지를 작성할 수있는 코드를 추가 할 수 있습니까? –