Code covered by the BSD License  

Highlights from
Analog Filter Design Toolbox

image thumbnail

Analog Filter Design Toolbox

by

 

27 Dec 2005 (Updated )

GUI to design and simulate active (opamp) LP and HP Bessel, Butter, Cheby, and Elliptic filters.

Utility_CalculateTime(z,p,k,ti,tf,DoWhat)
function [y,t] = Utility_CalculateTime(z,p,k,ti,tf,DoWhat)
% Utility_CalculateTime is a subfile of the AnalogFilter GUI collection
%
% James C. Squire, 2002
% Assistant Professor, Virginia Military Institute
% ver 1.0

% Utility_CalculateTime finds the time response of a system
% [y,t] = Utility_CalculateTime(z,p,k,ti,tf,DoWhat)

NSAMPLES = 500;

% create t
ts = (tf-ti)/(NSAMPLES-1);
t=[0:ts:tf]';

% add an extra integrator for step,ramp responses
switch DoWhat  
    case 'Impulse'
    case 'Step'
        p = [p; 0];
    case 'Ramp'
        p = [p; 0; 0];
    case 'Parabola'
        p = [p; 0; 0; 0];
    otherwise
        error('Unknown DoWhat switch')
end

% convert from zpk to ss
[a,b,c,d] = Utility_zpk2ss(z,p,k);

% convert from ct to dt
d = c * b;
a = expm(a*ts);
b=a*b;
u = eye(size(t));
x0 = zeros(size(a,1),1); % zero initial state
tt = ltitr(a,b,u,x0);
y = tt * c';
y(1) = y(1) + d;

Contact us