📄 homotime.m
字号:
function homoTime(x, Fs)
index1 = Fs/500; % maximum speech freq = 500Hz
index2 = Fs/50;%minimum speech freq supposed to be 50Hz
subplot(2,1,1),plot(x);title('Signal');xlabel('Time(ms)'); ylabel('Amplitude');
auto=xcorr(x,index2,'coeff'); %autocorrelation
d=(-index2:index2)/Fs;
subplot(2,1,2),plot(d,auto);
title('Autocorrelation');xlabel('Delay(ms)'); ylabel('Correlation Coefficient');
auto=auto(index2+1:2*index2+1);%taking one side of the autocorrelation
[auto_maxim,locs]=max(auto(index1:index2)); %searching for maxima in min to max range
fprintf('Pitch Frequency in Time Domain = %gHz\n',Fs/(index1+locs-1));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -