Differential Equation Error: "Warning: Unable to find explicit solution"
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi Guys,
I'm trying to solve a system of differential equations using matlab. Here is my code (take out the beginning and ending paranthesis):
clc;clear all
syms x1(t) x2(t) x3(t)
A=[-(.0211*heaviside(t-500)+.2111*heaviside(t-500)+.015)*(x1) .0111*(x1) .0039*(x1); 0.0124*(x2) -.0286*(x2) 0; 0.000035*(x3) 0 -.000035*(x3)];
B=[49.3; 0; 0];
Y=[x1(t); x2(t); x3(t)]
odes = diff(Y) == A*Y + B
[x1Sol(t), x2Sol(t), x3Sol(t)] = dsolve(odes);
x1Sol(t) = simplify(x1Sol(t))
x2Sol(t) = simplify(x2Sol(t))
x3Sol(t) = simplify(x3Sol(t))
C = Y(0) == [0; 0; 0];
[x1Sol(t), x2Sol(t), x3Sol(t)] = dsolve(odes,C)
for i=1:800
x1(i)=x1Sol(i)
x2(i)=x2Sol(i)
x3(i)=x3Sol(i)
end
hold on
plot(x1)
plot(x2)
plot(x3)
hold off
clearvars
ylabel('Micrograms of Lead')
xlabel('Number of Days')
legend('Amount in Blood', 'Amount in Tissue', 'Amount in Blood')"
I keep getting the following error message:
Warning: Unable to find explicit solution.
> In dsolve (line 201)
In MathFinal4 (line 8)
Error using sym/subsindex (line 845)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must
be symbolic variables, and function body must be sym expression.
Error in MathFinal4 (line 8)
[x1Sol(t), x2Sol(t), x3Sol(t)] = dsolve(odes);
Please Help!
I can't seem to fix this problem no matter how I arrange the differential equation (I've tried standard form and matrix form),
1 comentario
Star Strider
el 24 de Abr. de 2019
Your system is nonlinear so an analytic solution is not possible. Although odeToVectorField correctly transforms it, the heaviside calls prevent matlabFunction from creating an anonymous function for it.
Respuestas (2)
Sulaymon Eshkabilov
el 4 de Mayo de 2019
Hi,
Since you have the Step function, one of the most suitable Symbolic MATH toolbox functions for this type of ODEs is the Laplace transform and its inverse via laplace() and ilaplace()
0 comentarios
Om Yadav
el 24 de Abr. de 2020
We got it very well that closed formula does not exist for my problem. The question is how to get a numerical solution using dsolve?
0 comentarios
Ver también
Categorías
Más información sobre Equation Solving en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!