evaltf.m

来自「code of an ADC implementation woith matl」· M 代码 · 共 29 行

M
29
字号
function h = evalTF(tf,z)%h = evalTF(tf,z)%Evaluates the rational function described by the struct tf% at the point(s) given in the z vector.% TF must be either a zpk object or a struct containing%   form		'zp' or 'coeff'%   zeros,poles,k	if form=='zp'%   num,den		if form=='coeff'%% In Matlab 5, the ss/freqresp() function does nearly the same thing.if isobject(tf)		% zpk object    if strcmp(class(tf),'zpk')	h = tf.k * evalRPoly(tf.z{1},z) ./ evalRPoly(tf.p{1},z);    else	fprintf(1,'%s: Only zpk objects supported.\n', mfilename);    endelseif any(strcmp(fieldnames(tf),'form'))    if strcmp(tf.form,'zp')	h = tf.k * evalRPoly(tf.zeros,z) ./ evalRPoly(tf.poles,z);    elseif strcmp(tf.form,'coeff')	h = polyval(tf.num,z) ./ polyval(tf.den,z);    else	fprintf(1,'%s: Unknown form: %s\n', mfilename, tf.form);    endelse	% Assume zp form    h = tf.k * evalRPoly(tf.zeros,z) ./ evalRPoly(tf.poles,z);end

⌨️ 快捷键说明

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