homotime.m

来自「this program deals with homomorphic anal」· M 代码 · 共 14 行

M
14
字号
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 + =
减小字号Ctrl + -
显示快捷键?