Do simfunctions support parameterized dosing?

조회 수: 2 (최근 30일)
Abed Alnaif
Abed Alnaif 2018년 11월 5일
댓글: Abed Alnaif 2018년 11월 5일
The examples in the documentation regarding parameterized dosing do not use the simfunction, but I figured that it should work with simfunctions, since I didn't find anything in the documentation to indicate otherwise. But I'm not able to get the examples to work using simfunctions, using R2018b. Do simfunctions support parameterized dosing? Please find the code below for an example:
%%Example from Matlab documentation:
% https://www.mathworks.com/help/simbio/ref/repeatdoseobject.html
model = sbiomodel('simple model');
compartment = addcompartment(model,'Central',1);
compartment.CapacityUnits = 'liter';
species = addspecies(model,'drug');
species.InitialAmountUnits = 'milligram';
% Elimination rate
elimParam = addparameter(model,'kel',0.1);
elimParam.ValueUnits = '1/hour';
% Elimination reaction
reaction = addreaction(model,'drug -> null');
reaction.ReactionRate = 'kel*drug';
amountParam = addparameter(model,'A',50);
amountParam.ConstantValue = false;
amountParam.ValueUnits = 'milligram'
dose = adddose(model,'adaptive dose','repeat');
dose.Amount = 'A';
dose.TargetName = 'drug';
dose.StartTime = 0;
dose.TimeUnits = 'hour';
dose.Interval = 24;
dose.RepeatCount = 7;
weightParam = addparameter(model,'weight', 80);
weightParam.ValueUnits = 'kilogram';
scaleParam = addparameter(model,'doseAmountPerWeight',0.6);
scaleParam.ValueUnits = 'milligram/kilogram';
rule = addrule(model,'A = weight*doseAmountPerWeight','initialAssignment');
configset = getconfigset(model);
configset.StopTime = 7*24;
configset.TimeUnits = 'hour';
[time, drugAndAmount] = sbiosimulate(model,dose);
plot(time, drugAndAmount);
legend('drug','A');
%%It doesn't work using simfunctions
doseTbl = dose.getTable();
simFunction = createSimFunction(model,{},{'drug'},{'drug'});
simFunction([],10,doseTbl);

채택된 답변

Arthur Goldsipe
Arthur Goldsipe 2018년 11월 5일
Yes, parameterized doses are supported with SimFunctions. However, you cannot change the type of parameterization after creating a SimFunction. In your example, you created a SimFunction with a dose that was not parameterized, so you cannot simulate it with a parameterized dose table.
To create a SimFunction that uses a parameterized dose, replace your input {'drug'} with a "template" dose object that is parameterized. For example, you can re-use your existing dose for this by changing the next-to-last line of code to the following:
simFunction = createSimFunction(model,{},{'drug'},dose);
  댓글 수: 1
Abed Alnaif
Abed Alnaif 2018년 11월 5일
Thanks, I was able to get it to work with your suggestion.

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

추가 답변 (0개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Scan Parameter Ranges에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by