Code covered by the BSD License  

Highlights from
Delta Sigma Toolbox

image thumbnail

Delta Sigma Toolbox



14 Jan 2000 (Updated )

High-level design and simulation of delta-sigma modulators

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

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);
	fprintf(1,'%s: Only zpk objects supported.\n', mfilename);
elseif 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);
	fprintf(1,'%s: Unknown form: %s\n', mfilename, tf.form);
else	% Assume zp form
    h = tf.k * evalRPoly(tf.zeros,z) ./ evalRPoly(tf.poles,z);

Contact us