shanks.m

来自「solution for the Statistical modelling f」· M 代码 · 共 69 行

M
69
字号
function [a,b,err] = shanks(x,p,q)%SHANKS	Model a signal using Shanks' method %----%Usage: [a,b,err] = shanks(x,p,q) %%	The sequence x is modeled as the unit sample response of%	a filter having a system function of the form%		H(z) = B(z)/A(z) %	The polynomials B(z) and A(z) are formed from the vectors%		b=[b(0), b(1), ... b(q)]%		a=[1   , a(1), ... a(p)]%	The input q defines the number of zeros in the model%	and p defines the number of poles.  The modeling error%	is returned in err.%%  see also ACM, COVM, PADE, PRONY%%---------------------------------------------------------------% copyright 1996, by M.H. Hayes.  For use with the book % "Statistical Digital Signal Processing and Modeling"% (John Wiley & Sons, 1996).%---------------------------------------------------------------x   = x(:);N   = length(x);if p+q>=length(x), error('Model order too large'), enda   = prony(x,p,q);u   = [1; zeros(N-1,1)];g   = filter(1,a,u);G   = convm(g,q+1);b   = G(1:N,:)\x;err = x'*x-x'*G(1:N,1:q+1)*b;end;

⌨️ 快捷键说明

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