@FinalProject_ode must return a column vector (solved)
1 view (last 30 days)
Show older comments
I have attached some of my ode and calculation functions. Im juist confused on what the matlab error "ode must return a column vector" and how i should go about resolving it
function dydt = FinalProject_ODE(t,y,p)
%% Stuff that is in the format of ode
pCell = mat2cell(p,ones(size(p,1),1),ones(size(p,2),1));
[FFAtot,PUFAtot,OXYSTtot,GLUCOSEtot,PPARtot,LXRtot,RXRtot,Kon_1,Koff_1,Kon_2,...
Koff_2,Kon_6,Koff_6,Kon_7,Koff_7,Kon_TF1,Koff_TF1,Kon_TF2,Koff_TF2,Kon_TF3,Koff_TF3,Kon_TF4,Koff_TF4,...
Kon_10, Koff_10, Kon_5, Koff_5] = pCell{:};
yCell = mat2cell(y,ones(size(y,1),1),ones(size(y,2),1));
[PPARuFFA, PPARuPUFA, LXRuGLUCOSE, LXRuOXYST,...
TF1, TF2, TF3, TF4, PPARuLXR, LXRuPUFA] = yCell{:};
%% Conservation equations
FFA = FFAtot - PPARuFFA - TF1;
PUFA = PUFAtot - PPARuPUFA - TF2;
OXYST = OXYSTtot - LXRuOXYST - TF3;
GLUCOSE = GLUCOSEtot - LXRuGLUCOSE - TF4;
PPAR = PPARtot - PPARuFFA - PPARuPUFA - TF1 - TF2 - PPARuLXR;
LXR = LXRtot - LXRuOXYST - LXRuGLUCOSE - LXRuPUFA - PPARuLXR - TF3 - TF4;
RXR = RXRtot - TF1 - TF2 - TF3 - TF4;
%% Rate Equations
dPPARuFFA = Kon_1*FFA*PPAR - Koff_1*PPARuFFA + Koff_TF1*TF1 - Kon_TF1*PPARuFFA*RXR;
dPPARuPUFA = Kon_2*PPAR*PUFA - Koff_2*PPARuPUFA - Kon_TF2*PPARuPUFA*RXR + Koff_TF2*TF2;
dLXRuOXYST = Kon_6*LXR*OXYST - Koff_6*LXRuOXYST + Koff_TF3*TF3 - Kon_TF3*LXRuOXYST*RXR;
dLXRuGLUCOSE = Kon_7*LXR*GLUCOSE - Koff_7*LXRuGLUCOSE + Koff_TF4*TF4 - Kon_TF4*LXRuGLUCOSE*RXR;
dTF1 = Kon_TF1*PPARuFFA*RXR - Koff_TF1*TF1;
dTF2 = Kon_TF2*PPARuPUFA*RXR - Koff_TF2*TF2;
dTF3 = Kon_TF3*LXRuOXYST*RXR - Koff_TF3*TF3;
dTF4 = Kon_TF4*LXRuGLUCOSE*RXR - Koff_TF4*TF4;
dLXRuPUFA = Kon_10*LXR*PUFA - Koff_10*LXRuPUFA;
dPPARuLXR = Kon_5*PPAR*LXR - Koff_5*PPARuLXR;
dydt = [dPPARuFFA dPPARuPUFA dLXRuOXYST dLXRuGLUCOSE...
dTF1 dTF2 dTF3 dTF4 dPPARuLXR dLXRuPUFA];
I am just trying to plot the for TF# values on a plot to compare their outputs and eventually do a sensitivity analysis of the data
0 Comments
Answers (2)
Walter Roberson
on 11 Dec 2019
dydt = [dPPARuFFA dPPARuPUFA dLXRuOXYST dLXRuGLUCOSE...
dTF1 dTF2 dTF3 dTF4 dPPARuLXR dLXRuPUFA];
creates a row. You need to output a column. You can add the .' operator after the ] to transpose it.
Star Strider
on 11 Dec 2019
Assuming all the elements are scalars, either transpose ‘dydt’ or put semicolons between the elements:
dydt = [dPPARuFFA; dPPARuPUFA; dLXRuOXYST; dLXRuGLUCOSE; dTF1; dTF2; dTF3; dTF4; dPPARuLXR; dLXRuPUFA];
That should work.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!