A Cardiovascular Simulator for Research 1.0.0
(1,371 bytes)
% The function ans_filt.m creates an autonomic filter to be
% convolved with 1/(f^alpha) noise in order to generate the
% exogenous disturbance to F.
%
% Function arguments:
% th - current parameter values
% S - 3x1 vector containing the desired granularity, duration
% of autonomic impulse responses, and averaging ratio of
% length of averaging window to Sgran
% - [Sgran; Slength; Sratio]
%
% Function outputs:
% h - vector representing discrete-time, autonomic filter
%
function h = ans_filt(th,S)
% Assigning variables.
Sgran = S(1);
Slength = S(2);
Sratio = S(3);
% Pre-allocating memory for autonomic impulse responses.
sir = zeros(Slength,1);
vir = zeros(Slength,1);
% Creating unit-area beta-sympathetic impulse response.
st1 = ((2/Sgran)-((Sratio*Sgran/2)/Sgran))+1;
en1 = length(Sgran:Sgran:3.0)+st1-1;
st2 = en1+1;
en2 = length(Sgran:Sgran:25.0)+st2-1;
sir(st1:en1) = ((1.0/42.0)*(Sgran:Sgran:3.0))';
sir(st2:en2) = ((-1.0/350.0)*(Sgran:Sgran:25.0)+(1.0/14.0))';
sir = Sgran*sir;
% Creating unit-area parasympathetic impulse response.
numz = (0.5-(Sratio*Sgran/2))/Sgran;
st1 = 1+numz;
en1 = length(Sgran:Sgran:1)+st1-1;
st2 = en1+1;
en2 = length(Sgran:Sgran:1)+st2-1;
vir(st1:en1) = (1)*(Sgran:Sgran:1)';
vir(st2:en2) = (1)*(-(Sgran:Sgran:1)+1)';
vir = Sgran*vir;
% Forminig autonomic impulse response.
h = th(38)*sir+th(39)*vir;