필터 지우기
필터 지우기

Differential Equation Error: "Warning: Unable to find explicit solution"

조회 수: 1 (최근 30일)
Michael Bortolot
Michael Bortolot 2019년 4월 23일
답변: Om Yadav 2020년 4월 24일
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
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
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()

Om Yadav
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?

카테고리

Help CenterFile Exchange에서 Equation Solving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by