Hello, I’m trying to use external_function option. My m file is as follows:
function a = exter(b)
if b<=0.2
a=0.02b;
elseif b>0.2
a=0.004+0.1(b-0.2);
end
end
In mod file:
external_function(name=exter);
model(linear);
death=exter(infected);
end;
When I am running it works but the results of death are not right(I mean that death=0.02*infected always). What’s wrong with my m file?
How can be fixed this problem?
One more question. When I’m using ramsey policy under perfect foresight setup and including death in planner’s objective function (for example 100death^2 , 50000death^2, 1000000*death^2 ) it works in cases of 100 ,1000000(small and very big weight) but in cases of middle weights I get the following:
Simulation of the perfect foresight model failed!
Switching to a homotopy method…
and after
Failed to solve perfect foresight model.
What’s the reason of the failure?