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!