How to solve coupled differential equation?

Not entirely too sure how to get started solving two differential equations at the same time. I've only had experience doing one with Euler's method. A push in the right direction would be appreciated, thanks.

1 Comment

Notice that then this becomes the linear first order homogeneous equation, hence then solution for it is .

Sign in to comment.

Answers (1)

See the "Systems of ODEs" section on this documentation page.

11 Comments

Does that section still apply to two dependent variables?
It applies to any number of variables. The order of your system of ODE's will simply determine the size of the state vector you need to use with the MATLAB functions.
Hello dear Lord. Can you help me to get the solutions for y(x) and z(x) in two coupled differential equations simultaneously? I need solutions for each of y and z as the equations (for example y=C1 exp (A/B)x or z=C1 exp (B//A)x) not as numbers.
To solve a system of differential equations symbolically you will need to use Symbolic Math Toolbox.
Sam Chak
Sam Chak on 11 Apr 2022
Edited: Sam Chak on 11 Apr 2022
Just curious. Why did you repost here? I thought you have satifactorily accepted the Answer by @Walter Roberson 9 months ago. If you are looking for a new Answer from a different perspective, shouldn't you post a new question?
Anyhow, this should give you the overall picture of the system behavior (divergence and convergence), depending on the selection of A and B.
I'm afraid that the system may not have a closed-form analytical solution that you are looking for.
Hello dear. It is not important if the system does not have a closed-form solution. I only need a reasonable solution for this system of coupled equations. I talked to Mr Walter Roberson and he did his best. He gave me a code of Maple, but his code is not being run in my Maple and it gives error. This is the reason that I tried to find somebody else to give me another idea for solving these equations. Can you generate a MATLAB or Maple code for solving these coupled equations even if boundary conditions y(0) and z(0) are to be considered as initial or boundary conditions to help solution procedure.
A = 1.0;
B = 1.0;
fun=@(x)[-A*x(1)*x(2)^4;-B*x(1)^2*x(2)^3];
y0 = 1.0;
z0 = 1.0;
x0 = [y0;z0];
tspan = [0 1];
[T,Z] = ode45(fun,tspan,x0)
plot(T,Z)
If you are looking for a new Answer, or specifically the MATLAB code to solve the ODE when the constants A and B, and initial values are known, then post a new question with the information clearly provided:
  • ODE of the nonlinear system,
  • constant values of A and B,
  • initial values of and .
Please clearly describe what type of solution that you desire since the closed-form analytical solution is impossible. For example, you may say that a numerical solution is not good enough. At least, an Approximate Analytical Solution is desired, which maybe achievable with the generation of sufficient dat points and the Curve-Fitting Toolbox.
In fact, @Torsten has provided an Example of how to solve it. It is not good to continue 'hijacking' another user's question especially when yours is not directly related to it.
Ok, Thankyou very much.
But the answer provided by dear @Torsten does not give any answer and it gives me error in MATLAB.
The time 't' is missing. It should be fine now.
fun = @(t, x)[-A*x(1)*x(2)^4;-B*x(1)^2*x(2)^3];
Mr. Sam Chak and Mr. Torstan as you adviced I posted a new question in Mathwork. I would be greatful if you could help me. This is the link:
https://www.mathworks.com/matlabcentral/answers/1694515-getting-a-solution-for-two-coupled-nonlinear-differential-equations

Sign in to comment.

Tags

Asked:

on 30 Jan 2018

Commented:

on 11 May 2022

Community Treasure Hunt

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

Start Hunting!