Another question I have, is there a way to create a variable on the Workspace outside of the function with a command inside the function?
Get extra outputs from a function called via odesolver
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello
I'm modelling a system of differential algebraic equations, I make a file to use/call the ode solver on the model inside fun(t,y)
function [t,y,...]=callDAE
[t1,y1]=ode15s(@(t,y) fun(t,y),tspan,y0,options);
.
.
.
end
(In options I define the DAE mass matrix)
Inside fun(t,y) I calculate a lot of variables.
Using the outputs for [t1,y1], It's posible to calculate again the same variables in callDAE, but that mean to write again a lot of functions, and some other problems. So I wan't to know if is possible to get the variables calculated inside fun(t,y) to use them on callDAE?
Just as an example, the next code is something like I want, but the odesolvers can't be used that way:
function [t,y,...]=callDAE
[t1,y1,Kp,Lq,Rz,Mw,...]=ode15s(@(t,y) fun(t,y),tspan,y0,options);
.
.
.
end
The syntaxis on the example is not possible, according to the odesolver. The syntaxis is like on the documentation [T,Y,TE,YE,IE] = solver(odefun,tspan,y0,options), but that give 'events' relationed variables, im not interested on them.
Please tell if im not clear enough. Thanks
2 comentarios
Walter Roberson
el 2 de Abr. de 2012
assignin() -- but keep in mind that your function might be called at an arbitrary depth by ode15s.
Respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!