Hello, I’m trying to use external_function option. My m file is as follows:
function a = exter(b)
In mod file:
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?
Thanks in advance.
Are you using stochastic simulations? In that case, the model will be approximated and you will lose the non-differentiability.
Thanks for your reply.
No, I’m using deterministic simulation
Then I would need to see the full files.
baseline.mod (10.4 KB) exter.m (147 Bytes)
Your model is not linearly. So don’t specify
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…
Failed to solve perfect foresight model.
What’s the reason of the failure?
Here are my files:
baseline.mod (10.7 KB) exter.m (139 Bytes)
It’s hard to tell, but considerable size differences are often numerically problematic.