Problem Solving 2 Ordinary Differential equations
11 views (last 30 days)
Show older comments
What I have is.
function Dialysis=dc(t,c)
global k
V1=.70*33.2; %Intracellular fluid pool which is 70 percent of the total fluid volume of 33.2 liters
V2=.30*33.2; %Extracellular fluid pool which is 30 percent of the total fluid volume of 33.2 liters
g=.180; %urea production rate [g/hr]
b=4.61; %dialysis blood flow: [ltr/hr]
c=[c1;c2]; %Dependent variable c is a vector
c1=.63; %starting urea concentration in V1
c2=.63; %starting urea concentration in V2
dc1=(g-k*(c1-c2))/V1; %Equation governing the intracellular compartment
if (t>=1 & t<=3)
if(t>=25 & t<=27)
if(t>=49 & t<=51)
if(t>=73 & t<=75)
if(t>=87 & t<=89)
dc2=(k*(c1-c2)-b*c2)/V2;
else dc2=(k*(c1-c2))/V2;
end
dc=[dc1;dc2];
I am trying to call upon this funtion in another m file between times 0-99 hours. But all i receive are errors. How do I properely run this function so that it shows the model data c2 vs. t?
PLEASE HELP
0 Comments
Answers (1)
Walter Roberson
on 26 Nov 2013
Do not give a variable the same name as your function.
Do assign a value to the name given on the left side of the "=" in your function statement (i.e., Dialysis)
3 Comments
See Also
Categories
Find more on Fluid Dynamics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!