How to solve a system of odes where every equation is a function-handle?
1 次查看(过去 30 天)
显示 更早的评论
Well, my title tells all about my question.
I have a system (5x5) of differential equations. I have found these equations. Each equation is a function handle, like you can see bellow:
df1/dt = @(yq)interp1(y1,fy1,yq);
df2/dt = @(yq)interp1(y2,fy2,yq);
df3/dt = @(yq)interp1(y3,fy3,yq);
df4/dt = @(yq)interp1(y4,fy4,yq);
df5/dt = @(yq)interp1(y5,fy5,yq);
How can I solve this system by mean of ode45?
I can not solve them separately, like for example:
tspan = [0 10];
[~, X1approx] = ode45(@(t,y1)f1(y1, tspan, x0);
This is the reason why I am struggling with this one!
I have to send all 5 equations to ode45 at the same time. The reason of this is because the parameters in the function-handle-system are dependent on each other.
I am open for other type of solutions and/or suggestions.
Thanks for your help!!!
0 个评论
回答(1 个)
Jan
2014-10-5
You want to integrate a set of linear interpolations. Linear interpolations are not smooth and the reliability of the result will be questionable, see http://www.mathworks.com/matlabcentral/answers/59582#answer_72047 .
It is not clear what "y1" and "fy1" etc. contain. As long as we cannot see, how the equations are coupled, it is impossible to guess how this can be implemented. The anonymous function for "dx1/dt" has teh input "x1", but does not use it?!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!