How to collect the calculation history during the solving of ODE's
10 views (last 30 days)
Show older comments
Hi,
I am solving a set of eight 1st order ODE's. The actual differential equations have been defined in a separate function (obviously), but besides these main equations, there are several other calculation steps which are performed within that function.
Question: The ODE-solver only returns the numerical solution of the ode's. is there any way to collect all the other output which is generated during each iteration step?
Short simplified overview of my model (final output is C, R links to another function, which also has C as variable):
poly=(C(1)+C(2)+C(4)+C(5))/2; xv=(P.*y)./(P.*g);
B=(poly/(1-sum(xv)));
dcdz(1)=-2*R(1);
(...)
dcdz(6)=R(1)-R(4)-(C(6)-B(1));
dcdz(7)=R(7)+R(8)-(C(7)-B(2));
dcdz(8)=R(4)+R(5)-(C(8)-B(3));
In this case, I am interested in the values of B. The program executes this function for each iteration step, so B is calculated every time. I can see them in the command window when I remove the semicolon, but so far, I have been unable to collect the values of B in an array.
Any suggestions?
Thanks,
Wikke den Hartogh
0 Comments
Accepted Answer
Andrew Newell
on 4 Apr 2011
If you just want the value of B at each point in the solution, you could calculate it afterwards using a function that inputs C and outputs B.
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!