While solving with ode15 i want to put to the limit to variable.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
In the code below, Value of (Crec + Ccells) must not exceed Rtot. and after limiting it, the ode must still solve the equations for other t. I need a graph as this.
clc; clear;
opts = odeset('stats','on');
C0 = [6.21E-6, 0, 0, 0, 0]; %Initial Values (umol)
tspan = 0:0.125:4400; %Time span
[t, C] = ode15s(@fn, tspan, C0, opts); %Solving ODEs in Function (fn)
C_mn = C(:,1);
C_ecm = C(:,2);
C_rec = C(:,3);
C_circ = C(:,4);
C_cells = C(:,5);
plot(t,C_mn,t,C_ecm,t,C_rec,t,C_circ,t,C_cells),grid on, grid minor
%ylim ([0 7E-6])
%xlim([0 4000])
xlabel('t (in s)'),ylabel('C (in umol/mm^3')
legend('Cmn','Cecm','Crec','Ccirc','Ccells')
function dCdt = fn(t, C)
%Constant Parameters
Cmn0 = 6.21E-6; %Initial conc at the MN (umol/MN)
tr = 1.8E3; %release period (s)
ka = 5E6; %Association rate (in 1/s)
kd = 5E-4; %Dissociation rate (in 1/s)
ki = 5.05E-3; %Internalization rate (in 1/s)
kc = 5E-3; %Circulation uptake rate (in 1/s)
Rtot = 1.85E-6 ; %initial receptor concentration (in receptors/mm^3)
r = Cmn0/tr*(t<=tr) + 0*(t>tr);
C_mn = C(1);
C_ecm = C(2);
C_rec = C(3);
C_circ = C(4);
C_cells = C(5);
dCdt = [-r;
r - ((ka * C_ecm) * (Rtot - C_rec - C_cells)) + (kd * C_rec) - (kc * C_ecm);
((ka * C_ecm) * (Rtot - C_rec - C_cells)) - ((kd + ki)* C_rec);
kc * C_ecm;
ki * C_rec];
end
0 Kommentare
Antworten (1)
Alan Stevens
am 17 Apr. 2021
Like this?
opts = odeset('stats','on');
C0 = [6.21E-6, 0, 0, 0, 0]; %Initial Values (umol)
tspan = 0:0.125:4400; %Time span
[t, C] = ode15s(@fn, tspan, C0, opts); %Solving ODEs in Function (fn
C_mn = C(:,1);
C_ecm = C(:,2);
C_rec = C(:,3);
C_circ = C(:,4);
C_cells = C(:,5);
plot(t,C_mn,t,C_ecm,t,C_rec,t,C_circ,t,C_cells),grid on, grid minor
%ylim ([0 7E-6])
%xlim([0 4000])
xlabel('t (in s)'),ylabel('C (in \mumol/mm^3')
legend('Cmn','Cecm','Crec','Ccirc','Ccells')
function dCdt = fn(t, C)
%Constant Parameters
Cmn0 = 6.21E-6; %Initial conc at the MN (umol/MN)
tr = 1.8E3; %release period (s)
ka = 5E6; %Association rate (in 1/s)
kd = 5E-4; %Dissociation rate (in 1/s)
ki = 5.05E-3; %Internalization rate (in 1/s)
kc = 5E-3; %Circulation uptake rate (in 1/s)
Rtot = 1.85E-6 ; %initial receptor concentration (in receptors/mm^3)
r = Cmn0/tr*(t<=tr) + 0*(t>tr);
C_mn = C(1);
C_ecm = C(2);
C_rec = C(3);
C_circ = C(4);
C_cells = C(5);
Csum = C_rec + C_cells;
if Csum>=Rtot, Csum = Rtot; end
dCdt = [-r;
r - ((ka * C_ecm) * (Rtot - Csum)) + (kd * C_rec) - (kc * C_ecm);
((ka * C_ecm) * (Rtot - Csum)) - ((kd + ki)* C_rec);
kc * C_ecm;
ki * C_rec];
end
2 Kommentare
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!