how to solve coupled both differential equations and normal equations
1 次查看(过去 30 天)
显示 更早的评论
I know how to use ode45 to solve the coupled differential equations. The problem now is there are many other variables. Let's say I want to solve coupled differential equations related to variable A (colume matrix) and t. t as the time.
dA(1)/dt= 6x(A(1)-A(2))- B(1)x(A(1)-A(6))
dA(2)/dt= 5x(A(2)-A(3))- B(2)x(A(2)-A(6))
dA(3)/dt= 4x(A(3)-A(4))- B(3)x(A(3)-A(6))
dA(4)/dt= 3x(A(4)-A(5))- B(4)x(A(4)-A(6))
dA(5)/dt= -B(5)x(A(5)-A(6))+C+ D
dA(6)/dt= B(1)x(A(1)-A(6))+B(2)x(A(2)-A(6))+B(3)x(A(3)-A(6))+B(4)x(A(4)-A(6))+B(5)x(A(5)-A(6))+E+F
And the B,C,D,E,F are variables dependent on A(1), A(2),A(3), A(4),A(5), A(5)and also one another.
For example
B(1)+B(2)+B(3)+B(4)+B(5)+B(6)=C
D=6x(A(2)-A(3))
E=7x(A(1)-A(6))
and so on.
And finally I might need to draw A(t) figure and B(t)figure
I don't know how to solve this by using ode45 or if I should still using ode45. Please help. Thank you.
0 个评论
采纳的回答
Torsten
2015-10-5
Before supplying dA(1)/dt,...,dA(6)/dt for ode45, just evaluate the algebraic variables, e.g. D=6*(A(2)-A(3)).
Or what exactly is your problem ?
Best wishes
Torsten.
2 个评论
Torsten
2015-10-5
You don't have to evaluate them before using ode45, but within the function where you compute the time-derivatives.
Look at example 1 under
In the routine "rigid", before supplying dy(1),dy(2) and dy(3) (which could stand for dA(1)/dt,dA(2)/dt and dA(3)/dt), you can evaluate D as D=6*(y(2)-y(3)).
Best wishes
Torsten.
更多回答(0 个)
另请参阅
类别
在 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!