What's the best snipet for get the first batch of fft abs greater than half the maximum?

10 ビュー (過去 30 日間)
Georges Theodosiou
Georges Theodosiou 2022 年 10 月 21 日
編集済み: Georges Theodosiou 2022 年 10 月 31 日
Dear sirs, pls let me ask your forgive for my previous wrong question. I expect catch first harmonic (FFT's pitch) by catcing the first batch of fft abs greater than half the maximum. I suppose, in human's voice and in violin's sound first harmonic's fft abs is greater than half the maximum, 2.3610e+08 in code. Then by max fucnion catch first harmonic's. What's the best snipet for catch first batch greater than half the "FFTabs"?
SampFreq = 16000;
Segm = 1:2048;
Pitch = 45;
FirstHarmAngles = Pitch*2*pi/SampFreq*Segm+1.9*pi;
SinFirstHarmAngles = sin(FirstHarmAngles);
SecondHarmAngles = Pitch*2*2*pi/SampFreq*Segm+2.9*pi;
SinSecondHarmAngles = sin(SecondHarmAngles);
ThirdHarmAngles = Pitch*3*2*pi/SampFreq*Segm+0.3*pi;
SinThirdHarmAngles = sin(ThirdHarmAngles);
Xn = 170000*SinFirstHarmAngles+220000*SinSecondHarmAngles+150000*...
SinThirdHarmAngles;
FFTXn = fft(Xn,16384);
FFTabs = abs(FFTXn);
plot(FFTabs(1:200));

回答 (1 件)

Georges Theodosiou
Georges Theodosiou 2022 年 10 月 26 日
編集済み: Georges Theodosiou 2022 年 10 月 31 日
Dear sirs let me answer my qustion.
maxabs = max(FFTabs);
firstBatch = zeros(1,2048);
for a = 1:2048
firstBatch(a) = FFTabs(a);
if FFTabs(a)>maxabs/2 && FFTabs(a+1)<maxabs/2
break
end
end
[maxInFirstBatch, FFTpitch] = max(firstBatch)

カテゴリ

Help Center および File ExchangeMeasurements and Spatial Audio についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by