d2d.m

来自「本书是电子通信类的本科、研究生辅助教材」· M 代码 · 共 30 行

M
30
字号
function [a, b] = d2d(phi, gamma, t1, t2)
%D2D	Conversion of discrete state-space models to models with diff. sampling times.
%	[A2, B2] = D2D(A1, B1, T1, T2)  converts the discrete-time system:
%
%		x[n+1] = A1 * x[n] + B1 * u[n]
%
%	with a sampling rate of T1 to a discrete system with a sampling rate of T2.
%	The method is accurate for constant inputs. For non-integer multiples of T1
%	and T2, D2D may return complex A and B matrices. 
%
%	See also D2C and C2D.

%	Copyright (c) 1990-94 by The MathWorks, Inc.
%	Andrew C. W. Grace 2-20-91

error(nargchk(4,4,nargin));
error(abcdchk(phi,gamma));

[m,n] = size(phi);
[m,nb] = size(gamma);

nz = nb;
nonzero = [1:nb];

s = [[phi gamma(:,nonzero)]; zeros(nz,n) eye(nz)]^(t2/t1);
a = s(1:n,1:n);
if length(nonzero)
	b(:,nonzero) = s(1:n,n+1:n+nz);
end

⌨️ 快捷键说明

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