Differential Equation Error: "Warning: Unable to find explicit solution"
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2019-4-24
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.
回答(2 个)
Sulaymon Eshkabilov
2019-5-4
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 个评论
Om Yadav
2020-4-24
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!