Scaling of a system of coupled differential equation and is it possible?

6 Ansichten (letzte 30 Tage)
Hello everyone.
I have a system of coupled differential equation and I am using ode45 to solve it. The code is as following
clc
clear all
f = @(t,x) [-x(4)-(0.0424)+(1.6977)*exp(-1.48e36*(x(1)^2));
x(4)-(0.0663)+(2.6540)*exp(-6.0653e35*(x(2)^2));
-(2.994e5)*x(4);
3.6999e7*(7.124e17*(x(1)^2)-2.915e17*(x(2)^2)+x(3)+60*(cos(t)))-2.55 3.6999e7*x(4)];
[t,xa] = ode45(f,[0, 80],[0,0,-62,0]);
This code is right to my knowledge. The problem is I am facing out of memory problem while running this. Takes too much time and my pc doesnt have enough ram to run it maybe. Now, I do have a sample code from a Professor. The is is as follows
clc
clear all
f = @(t,x) [-x(4)-(1.10*10^-8)+(5.6*10^-6)*exp(-1.35*10^20*(x(1)^2));
x(4)-(1.10*10^-8)+(5.6*10^-6).*exp(-1.35*10^20*(x(2)^2));
-(0.23)*x(4);
-0.40*x(4)+x(3)+11.33*(x(1)^2)-11.33*(x(2)^2)+60*(cos(t))];
[t,xa] = ode45(f,[0, 80],[0,0,-120,0]);
Now the concerning part for me is, if we look closely at the third and fourth equation of both code, the coefficients differ by a huge margin. I am 90% sure that the coefficients I derived are true because they match to a paper. The sample code runs quickly.
Now, my question is, is it possible to scale down a system of differential equation. To me it seems that the sample code is somehow scaled down. Can someone please let me know if it is possible and if possible, how to do it.
Thank you.

Akzeptierte Antwort

Torsten
Torsten am 9 Feb. 2023
Verschoben: Torsten am 9 Feb. 2023
If possible, use different units for physical parameters involved such that values like exp(-1.48e36*(x(1)^2)), exp(-6.0653e35*(x(2)^2)), 7.124e17*(x(1)^2), 2.915e17*(x(2)^2) become much, much smaller.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by