Getting a solution for two coupled nonlinear differential equations

6 Ansichten (letzte 30 Tage)
Hello dears. I am looking for the solutions for y(t) and z(t) 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)t or z=C1 exp (B//A)t) not as numbers if it is possible.
At least, an Approximate Analytical Solution is desired, which may be achievable with the generation of sufficient dot points and the Curve-Fitting Toolbox.
  • ODE of the nonlinear system,
  • constant values of A and B,
  • initial values of y0 and z0.
Both y(t) and z(t) are functions of t. Here, A and B are constant values. We want to get a solution for each of the dependent variables of y(t) and z(t). If it is needed the initial values of y0=y(0) and z0=z(0) can be used to achieve the solution.

Akzeptierte Antwort

Sam Chak
Sam Chak am 12 Apr. 2022
Bearbeitet: Sam Chak am 12 Apr. 2022
Please check if this works out for your study:
A = 1.0;
B = 1.0;
fun = @(t, x)[-A*x(1)*x(2)^4; % 1st ODE
-B*x(1)^2*x(2)^3]; % 2nd ODE
tspan = [0 1e2];
y0 = 1.0; % initial value of y(t)
z0 = 1.125*y0; % initial value of z(t)
x0 = [y0;
z0];
[T, Z] = ode45(fun, tspan, x0); % Solver assigns solutions to Z array
y = Z(:,1); % numerical solution for y(t)
z = Z(:,2); % numerical solution for z(t)
% Fit well if A = 1; B = 1, and A = 1; B = -1
f1 = fit(T, y, 'rat23') % fit Rat23 model into y(t) data
f2 = fit(T, z, 'rat33') % fit Rat33 model into z(t) data
% Fit well if A = -1; B = 1
% f1 = fit(T, y, 'rat22') % fit Rat22 model into y(t) data
% f2 = fit(T, z, 'rat22') % fit Rat22 model into z(t) data
subplot(2, 1, 1)
plot(f1, T, y)
subplot(2, 1, 2)
plot(f2, T, z)
The Approximate Analytical Solution is a Rational Function:
f1 =
General model Rat23:
f1(x) = (p1*x^2 + p2*x + p3) /
(x^3 + q1*x^2 + q2*x + q3)
Coefficients (with 95% confidence bounds):
p1 = 1.925 (1.768, 2.083)
p2 = -0.4781 (-0.9759, 0.01979)
p3 = -0.246 (-0.5008, 0.008754)
q1 = 2.363 (1.718, 3.009)
q2 = -0.9528 (-1.554, -0.3518)
q3 = -0.2443 (-0.5014, 0.01292)
f2 =
General model Rat33:
f2(x) = (p1*x^3 + p2*x^2 + p3*x + p4) /
(x^3 + q1*x^2 + q2*x + q3)
Coefficients (with 95% confidence bounds):
p1 = 0.5208 (0.5195, 0.5221)
p2 = 12.22 (10.04, 14.4)
p3 = 50.82 (43.67, 57.96)
p4 = 21.52 (18.88, 24.16)
q1 = 24.87 (20.4, 29.34)
q2 = 68.33 (59.2, 77.46)
q3 = 19.15 (16.8, 21.5)
Results:
  6 Kommentare
Sam Chak
Sam Chak am 12 Apr. 2022
Thank you for your acceptance. Of course you may ask. This is a forum for users to discuss matters related to Mathworks products and to help each other. By the way, I have also edited the Answer to add a little more info on the code about the selection of the Rational function models.
sardar peysin
sardar peysin am 12 Apr. 2022
Mr. Sam, I am very thankful of you. You did your best. I will try both of these fitting models in the next days because I have not yet finished my formulations and I still don't have values of A and B and initial conditions. I will inform you. But you really helped me and you solved the problem. Thank you very much for proposing Rat23 and Rat22 fiting models.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

sardar peysin
sardar peysin am 12 Apr. 2022
Thankyou Mr. Sam. I think you got a reasonable answer. It seems to be very relaible.
I must try the result in my next calculations. It may take some time, but I will inform you about the correctness of the results.
Let me ask you another question about the obtained results. The curve fitted to the y-axis data gives us the following equation;
f(x) = (p1*x^2 + p2*x + p3) /(x^3 + q1*x^2 + q2*x + q3)
Here f(x) is y(t) or z(t)? (I maen is f(x)=y(t)?)
It seems that f(x)=y(t) here, and the obtained equation is an eqaution for y(t) which leads:
y(t)=f(t) = (p1*t^2 + p2*t + p3) /(t^3 + q1*t^2 + q2*t + q3)
If I am right, so, please tell me that can we find an equations for function z(t) if we use
f=fit(T, Z(:,2), 'rat23')
plot(f, T, Z(:,2))
instead of using
f = fit(T, Z(:,1), 'rat23')
plot(f, T, Z(:,1))
Please if z(t) is not obtained as what I said, so how we can find z(t) equation?
  4 Kommentare
Sam Chak
Sam Chak am 12 Apr. 2022
I also learn from examples.
To give an example why another Rational model should be chosen, let say we select
A = -1;
B = 1;
then the previous proposed Rational model (Rat23) does not fit well for y(t).
So, by trial-and-error, it is found that Rat22 model fits well for both y(t) and z(t) in this case.
f1 = fit(T, y, 'rat22') % fit Rat22 model into y(t) data
f2 = fit(T, z, 'rat22') % fit Rat22 model into z(t) data
sardar peysin
sardar peysin am 12 Apr. 2022
Mr. Sam, I am very thankful of you. You did your best. I will try both of these fitting models in the next days because I have not yet finished my formulations and I still don't have values of A and B and initial conditions. I will inform you. But you really helped me and you solved the problem. Thank you very much for proposing Rat23 and Rat22 fiting models.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Linear Model Identification finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by