我试图找到音频信号的 FFT 峰值的幅度和频率。执行 FFT 后,我使用了以下代码;
peak_points = [];
fmin = 60;
fmax = 1000;
region_of_interest = fmax>f & f>fmin;
froi = f(region_of_interest);
[p_max,loc] = max(seg_fft2(region_of_interest))
% index into froi to find the frequency of the peaks
p_max;
f_p_max = froi(loc);
[points, locatn] = findpeaks(seg_fft2(region_of_interest));
aboveMax = points > 0.4*p_max;
if any(aboveMax)
peak_points = [peak_points ; points(aboveMax) locatn(aboveMax)];
end
虽然我能够获得正确的幅度,locatn(aboveMax)
但没有给我频率......我需要做什么才能获得频率值?我尝试了以下行而不是locatn(aboveMax)
isfroi(locatn(aboveMax))
但我得到了错误
???使用 ==> horzcat 时出错
CAT 参数维度不一致。