sp1.m

来自「自己写的关于lpc分析与合成的Demo程序」· M 代码 · 共 29 行

M
29
字号

randn('state',1);
noise = randn(50000,1);  % Normalized white Gaussian noise
s = filter(1,[1 1/2 1/3 1/4 ],noise);
x = s(45904:50000);


[a,E] = lpc(x,10);
est_x = filter([0 -a(2:end)],1,x);    % Estimated signal
e = x - est_x;                        % Prediction error
[acs,lags] = xcorr(e,'coeff');  


figure(1)
plot(1:97,x(4001:4097),1:97,est_x(4001:4097),'--');
title('Original Signal vs. LPC Estimate');
xlabel('Sample Number'); ylabel('Amplitude'); grid;
legend('Original Signal','LPC Estimate')

figure(2)
plot(lags,acs); 
title('Autocorrelation of the Prediction Error');
xlabel('Lags'); ylabel('Normalized Value'); grid;

acsFFT=fft(acs);
figure(3);
plot(1:length(acs),fftshift(abs(acsFFT)));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?