Non linear differential equations system

Hello, i am trying to solve a non linear system but when i plot the solutions only a straight line in one of the variables appears on the graph, and all the variables just can't get away from the initial conditions. That's my code:
syms c1(t) c2(t) c3(t) c4(t) T Y
Eqns = [diff(c1(t),t) == -0.015*c1+1.8*10^(-14)*c2*c4;
diff(c2(t),t) == 0.015*c1-1.8*10^(-14)*c2*c4;
diff(c3(t),t) == -6*10^(-34)*c3*0.051765*10^(20)*0.2465*10^(20)+0.015*c1;
diff(c4(t),t) == 6*10^(-34)*c3*0.051765*10^(20)*0.2465*10^(20)-1.8*10^(-14)*c2*c4];
>> [DEsys,Subs] = odeToVectorField(Eqns);
>> DEFcn = matlabFunction(DEsys, 'Vars',{T,Y});
>> tspan = [0,50000];
>> y0 = [0.040923*10^(12) 0 0 0];
>> [T,Y] = ode45(DEFcn, tspan, y0);
>> plot(T,Y)
And that's my graph:
It sould have had some curves because it describes how ozon is formulated in the atmosphere. Any suggestions??

댓글 수: 3

An issue with problems like this is they are almost never solvable using tools like ODE45, at least not unless you know very much what you are doing. All of those constants that vary by dozens of powers of 10? Bad news, in triplicate. They mean that double precision arithmetic may possibly not be satisfactory to solve this, unless you manage to scale the problem very carefully. (I did say you have to know what you are doing in this.) At the very least, your problem will be stiff. So ODE45 will probably not be advisable to use. You might consider a tool like ODE15S instead.
thanos tria
thanos tria 2019년 3월 26일
i tried ode23s and ode15s and still straight line
You could consider using the MuPAD numeric ode routines; https://www.mathworks.com/help/symbolic/mupad_ref/numeric-odesolve.html
These are inside the Symbolic engine. As of R2019a it is still possible to invoke mupad to get an interactive MuPAD session, but it is not clear how much longer that will be available.
To use those routines without an interactive MuPAD interface, then you need to use
evalin(symengine, 'MUPAD CODE')
or
feval(symengine, 'MUPAD_FUNCTION_NAME', argument1, argument2, ...)
Generally speaking, not all Mupad arguments can be be constructed at all easily at the MATLAB level. In places that the MuPAD documentation shows arrays with [] then sometimes feval() with a MATLAB vector or array is fine, but other times getting the right argument type to make MuPAD happy can be a nuisance.

댓글을 달려면 로그인하십시오.

답변 (0개)

질문:

2019년 3월 26일

댓글:

2019년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by