필터 지우기
필터 지우기

how to solve coupled both differential equations and normal equations

조회 수: 1 (최근 30일)
jin wang
jin wang 2015년 10월 5일
댓글: Torsten 2015년 10월 5일
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.

채택된 답변

Torsten
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
jin wang
jin wang 2015년 10월 5일
Thank you for the reply.
My problem is I don't know how to make such relations work in matlab.
And I cannot just evaluate them before using ode45.By then there is no A. But I don't know if it is beacuase of A. I do have initial values for A. But the value of other variables should change along the time with A. if I just evaluate them before ode45 then they will not be evaluated again, since they are not in the ode45 functions.
I hope I explain my struggle here clearly.
Torsten
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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by