How to solve a system of odes where every equation is a function-handle?
조회 수: 2 (최근 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에서 Matrix Computations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!