Location: cellLib @ a7940fcacd45 / BG_fit / testM.m

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2023-04-04 15:51:18+12:00
Desc:
Add a steady state example
Permanent Source URI:
https://models.fieldml.org/workspace/6bc/rawfile/a7940fcacd455a09bdb7beac0da91eca79cf1adb/BG_fit/testM.m

% syms k_1r k_1f k_2r k_2f k_3r k_3f k_4r k_4f q_1 q_2 q_3 q_4 q_5 q_6 E v
% N_cf = sym([0 0 1 0; 0 1 0 0; 1 0 0 0; 0 0 0 1]);
% N_cr = sym([1 0 0 0; 0 0 1 0; 0 0 0 1; 0 1 0 0]);
% N_c = N_cr-N_cf;
% vec0=sym([0; 0; 0; 0]);
% vec1=sym([1; 1; 1; 1]);
% N_kf_T=sym([0 0 k_1f 0; 0 k_2f*q_2 0 0; k_3f 0 0 0; 0 0 0 k_4f;]);
% N_kr_T=sym([k_1r*q_1 0 0 0; 0 0 0 k_2r; 0 k_3r 0 0; 0 0 k_4r 0;]);
% %q_c= [q_3; q_4; q_5; q_6];
% N_v = N_c*(N_kf_T- N_kr_T);
% M=[N_v;vec1.'];
% M_R=[N_v(1:3,:);vec1.'];
% B = [vec0;E];
% B_R = sym([0; 0; 0; E]);
% q_c0=inv(M_R)*B_R;
% q_c=linsolve(M_R,B_R);
% isequaln(q_c0,q_c)
% isequaln(simplify(q_c0),simplify(q_c))
% q_6=q_c0(4);
% q_5=q_c0(3);
% v=k_4f*q_6-k_4r*q_5;

syms k_1r k_1f k_2r k_2f k_3r k_3f k_4r k_4f k_5r k_5f k_6r k_6f q_1 q_2 q_3 q_4 E
N_cf = sym([1 0 0 0 0 0; 0 0 0 1 0 0; 0 0 0 0 0 1; 0 1 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 1 0]);
N_cr = sym([0 0 1 0 0 0; 0 1 0 0 0 0; 1 0 0 0 0 0; 0 0 0 0 0 1; 0 0 0 0 1 0; 0 0 0 1 0 0]);
N_c = N_cr-N_cf;
vec1=sym([1; 1; 1; 1; 1; 1]);
N_kf_T=sym([k_1f*q_1 0 0 0 0 0; 0 0 0 k_2f 0 0; 0 0 0 0 k_3f 0; 0 k_4f*q_4 0 0 0 0; 0 0 0 0 0 k_5f; 0 0 k_6f 0 0 0]);
N_kr_T=sym([0 0 k_1r 0 0 0; 0 k_2r*q_2 0 0 0 0; k_3r*q_3 0 0 0 0 0; 0 0 0 0 0 k_4r; 0 0 0 0 k_5r 0; 0 0 0 k_6r 0 0]);
%q_c= [q_5; q_6; q_7; q_8; q_9; q_10];
N_v = N_c*(N_kf_T- N_kr_T);
M=[N_v;vec1.'];
M_R=[N_v(1:5,:);vec1.'];
B_R = sym([0; 0; 0; 0; 0; E]);
q_c0=inv(M_R)*B_R;
q_c=linsolve(M_R,B_R);
isequaln(q_c0,q_c)
isequaln(simplify(q_c0),simplify(q_c))
q_7=q_c0(3);
q_8=q_c0(4);
q_9=q_c0(5);
q_10=q_c0(6);
v6=k_6f*q_7-k_6r*q_8;
v5=k_5f*q_10-k_5r*q_9;
isequaln(simplify(v5),simplify(v6))
sim_v5=simplify(v5);

% Ne=[1,0, -1, 0;0, -1, 1, 0; -1, 0, 0, 1;0, 1, 0, -1];
% Ne = sym (Ne);
% syms k1r k1f k2r k2f k3r k3f k4r k4f q_Ai q_Ao
% Mf=[-k1r*q_Ai, 0, k1f, 0; 0, k2f*q_Ao, 0, -k2r; k3f, -k3r, 0, 0; 0, 0, -k4r, k4f];
% Me=sym([1,1,1,1]);
% M=[Ne*Mf;Me];
% rank(M)
% syms q3 q4 q5 q6 E v A B v1
% Qi = sym ([0;0;0;0;E]);
% qe=[q3;q4;q5;q6];
% 
% X = linsolve(M,Qi);
% q3=X(1);
% q5=X(3);
% v=k1f*q5-k1r*q_Ai*q3;
% A=k1f*k2f*k4f/(k4r*k3r*k2r);
% B=k4f/k4r+1;
% v1=(A*k3f*q_Ao-k1r*q_Ai)*k4f*E/((k4f+k3f*k4f/k3r+k4f*k2f/k2r/k3r*B*k3f*q_Ao)*(A*q_Ao+k1f*k4f/k4r/k2r+k1f/k4r)-(A*k3f*q_Ao-k1r*q_Ai)*((1+k4f/k2r)*B+k4f*k2f/k2r/k3r*B*q_Ao+k4f/k3r-1));
% isequaln(v,v1)
% simplify(v-v1)
% simplify(v/v1)
% simplify(v)