Is it possible to implement an array as a variable inside a state space matrix?

Hello all, I am new to control systems and state space matrix, I am working a creating a script for modeling the cardiovascular system. I have the statespace matrix for the model however the first varabile of the matrix C_dot/C(t) is a function that varies with time. I have the array for this variable but I am having trouble with how it is implemnted within the state matrix.
HR=60; %Heart Rate BPM
E_max=2; %mmHg/ml
E_min=.06; %mmHg/ml
t=0:.01:3;
t_c=60/HR; %Cardiac Cycle
T_max=.2+.15*t_c;
t_n=t./T_max;
%Normalized Elastance
A=((t_n./.7).^1.9)./(1+((t_n./.7).^1.9));
B=1./(1+((t_n./1.17).^21.9));
E_n=1.55.*A.*B;
%Elastance
E=(E_max-E_min).*E_n+E_min;
plot(t,E)
xlabel('Time(s)')
ylabel('mmHg/ml')
xlim([0 .8])
title('Graph of Elastance againt Time')
figure ()
%Compliance
C=1./E;
plot(t,C)
xlabel('Time(s)')
ylabel('ml/mmHg')
title('Graph of Compliance againt Time')
xlim([0 .8])
figure()
%Derivative of Compliance
C_dot=diff(C);
C_dot1=[C_dot,1];
C_both=-C_dot1./C;
plot(t,C_both);
xlabel('Time(s)')
xlim([0 .8])
ylabel('(-dC/dt)/C(t)')
title('Graph of -C_dot/C(t) againt Time')
%Constant Values of 5th order
Rs=1.0000; %Systemic Vascular Resistance(SVR)
Rm=0.0050; %Mitral Valve Resistance
Ra=0.0010; %Aortic Valve Resistance
Rc=0.0398; %Characteristic Resistance
Cr=4.4000; %Left Atrial Compliance
Cs=1.3300; %Systemic Compliance
Ca=0.0800; %Aortic Compliance
Ls=0.0005; %Inertance of blood in Aorta
%Matrix
%X1(t) LVP(t) Left Ventricular 7.6 mmHg
%X2(t) LAP(t) Left Atrial Pressure 7.6 mmHg
%X3(t) AP(t) Arterial Pressure 67 mmHg
%X4(t) AoP(t) Aortic Pressure 80 mmHg
%X5(t) Qao(t) Aortic Flow 0 ml/s
% 1's are in the place of variables that are arrays
A_matrix=[1 0 0 0 0;
0 -1/Rs*Cs 1/Rs*Cs 0 0 ;
0 1/Rs*Cs -1/Rs*Cs 0 1/Cs ;
0 0 0 0 -1/Ca ;
0 0 -1/Ls 1/Ls -Rc/Cs];

Antworten (1)

Star Strider
Star Strider am 1 Nov. 2023
You would have to integrate your model using one of the numerical integrators such as ode45. It is definitely possible to use your vector of values for it. See the documentation section on ODE with Time-Dependent Terms for details.

Kategorien

Produkte

Gefragt:

am 1 Nov. 2023

Beantwortet:

am 1 Nov. 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by