Problem Solving 2 Ordinary Differential equations

조회 수: 10 (최근 30일)
Jacob
Jacob 2013년 11월 26일
댓글: Jacob 2013년 11월 26일
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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 11월 26일
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
Walter Roberson
Walter Roberson 2013년 11월 26일
Please show the first five lines of the file Dialysis.m
Jacob
Jacob 2013년 11월 26일
The first lines are just commented as my name and such...the first line of code is on line 5,function Dialysis=dc(t,c)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fluid Dynamics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by