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에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!