System of differential equations, unable to find explicit solution with dsolve
2 views (last 30 days)
Show older comments
Myrto Kasioumi
on 24 Apr 2020
Commented: Star Strider
on 22 May 2020
Hi there!
I am trying to solve the following system of differential equations (4 equations and 4 unknowns):




where
and
and 



So, when I substitute all the derivatives I get the following system of differential equations:



I don't have any initial conditions or any values for the parameters.
I am not familiar with Matlab but after searching online I wrote this code which doesn't work:
syms S(t) P(t) c(t) z(t) A b g v k u d r w % k stands for τ, u for θ and v for a
eqn1 = diff(S,t) == A*(b*S)^(1-g)*(z^g) - k*z - c - b*S*(k+1)
eqn2 = diff(P,t) == u*z - d*P + (1-b)*S
eqn3 = diff(c,t) == (((1-b)/u) * (v - A*g*(b*S)^(1-g)*z^(g-1)) + b * (A*(1-g)*b^(-g)*S^(-g)*z^(g) -k -1) - r) * c
eqn4 = diff(z,t) == ((v - A*g*(b*S)^(1-g)*z^(g-1))/(A*(g-1)*g*(b*S)^(1-g)*z^(g-2))) * ((d - ((1-b) * (A*g*(b*S)^(1-g)*z^(g-1) - v))/u)) + (b / (A*(g-1)*g*(b*S)^(1-g)*z^(g-2))) * (((A*g*(b*S)^(1-g)*z^(g-1) - v)) * (A*b^(2-g)*(1-g)*S^(-g)*z^g - 1 - k) - (A*g*(1-g)*b^(1-g)*S^(-g)*z^(g-1)) * (A*(b*S)^(1-g)*z^g) - v*z - b*S*(k+1) - c) - (((1-w)*u *(1/P)) / (A*(g-1)*g*(b*S)^(1-g)*z^(g-2)))
sol = dsolve(eqn1,eqn2,eqn3,eqn4)
What I am getting back is the following error and an empty matrix of solutions:
Warning: Unable to find explicit solution.
> In dsolve (line 190)
But I am sure that there is a solution for that system.
The version of Matlab I am using is: 9.7.0.1319299 (R2019b) Update 5.
Can't seem to fix this problem even though I tried many things and I don't understand what I am doing wrong. I would really appreciate any help.
Thanks in advance!
0 Comments
Accepted Answer
Star Strider
on 24 Apr 2020
Not all differential equations (or integrals) have analytic sollutions. Yours are among them.
Try this:
% k stands for \tau, u for \Theta and v for a
syms S(t) P(t) c(t) z(t) A b g v k u d r w t Y
eqn1 = diff(S,t) == A*(b*S)^(1-g)*(z^g) - k*z - c - b*S*(k+1);
eqn2 = diff(P,t) == u*z - d*P + (1-b)*S;
eqn3 = diff(c,t) == (((1-b)/u) * (v - A*g*(b*S)^(1-g)*z^(g-1)) + b * (A*(1-g)*b^(-g)*S^(-g)*z^(g) -k -1) - r) * c;
eqn4 = diff(z,t) == ((v - A*g*(b*S)^(1-g)*z^(g-1))/(A*(g-1)*g*(b*S)^(1-g)*z^(g-2))) * ((d - ((1-b) * (A*g*(b*S)^(1-g)*z^(g-1) - v))/u)) + (b / (A*(g-1)*g*(b*S)^(1-g)*z^(g-2))) * (((A*g*(b*S)^(1-g)*z^(g-1) - v)) * (A*b^(2-g)*(1-g)*S^(-g)*z^g - 1 - k) - (A*g*(1-g)*b^(1-g)*S^(-g)*z^(g-1)) * (A*(b*S)^(1-g)*z^g) - v*z - b*S*(k+1) - c) - (((1-w)*u *(1/P)) / (A*(g-1)*g*(b*S)^(1-g)*z^(g-2)));
[VF,Subs] = odeToVectorField(eqn1,eqn2,eqn3,eqn4)
odefcn = matlabFunction(VF, 'Vars',{t,A,Y,b,d,g,k,r,u,v,w})
The ‘Subs’ output is important because it tells how the ‘Y’ vector elements are assigned, so ‘Y(1)=Subs(1)’ and so for the rest.
Supply scalar values for the other variables, and (probably) use:
@(t,Y) odefcn(t,A,Y,b,d,g,k,r,u,v,w)
as the function argument to the ODE solver of your choice.
.
6 Comments
More Answers (1)
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!