| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Symbolic Math Toolbox |
| Contents | Index |
| Learn more about Symbolic Math Toolbox |
dsolve('eq1','eq2',...,'cond1','cond2',...,'v')
dsolve(...,'IgnoreAnalyticConstraints',value)
dsolve('eq1','eq2',...,'cond1','cond2',...,'v') symbolically solves the ordinary differential equations eq1, eq2,... using v as the independent variable. Here cond1,cond2,... specify boundary or initial conditions or both. You also can use the following syntax: dsolve('eq1, eq2',...,'cond1,cond2',...,'v'). The default independent variable is t.
The letter D denotes differentiation with respect to the independent variable. The primary default is d/dx. The letter D followed by a digit denotes repeated differentiation. For example, D2 is d2/dx2. Any character immediately following a differentiation operator is a dependent variable. For example, D3y denotes the third derivative of y(x) or y(t).
You can specify initial and boundary conditions by equations like y(a) = b or Dy(a) = b, where y is a dependent variable and a and b are constants. If the number of the specified initial conditions is less than the number of dependent variables, the resulting solutions contain the arbitrary constants C1, C2,....
You can input each equation or a condition as a separate symbolic equation. The dsolve command accepts up to 12 input arguments.
dsolve can produce the following three types of outputs:
For one equation and one output, dsolve returns the resulting solution with multiple solutions to a nonlinear equation in a symbolic vector.
For several equations and an equal number of outputs, dsolve sorts the results alphabetically and assigns them to the outputs.
For several equations and a single output, dsolve returns a structure containing the solutions.
If dsolve cannot find a closed-form (explicit) solution, it attempts to find an implicit solution. When dsolve returns an implicit solution, it issues a warning. If dsolve cannot find either an explicit or an implicit solution, then it issues a warning and returns the empty sym. In such a case, you can find a numeric solution, using the MATLAB ode23 or ode45 functions. In some cases involving nonlinear equations, the output is an equivalent lower order differential equation or an integral.
dsolve(...,'IgnoreAnalyticConstraints',value) accepts the following values:
value = 'all' applies the purely algebraic simplifications to the expressions on both sides of equations. These simplifications might not be generally valid. The default value of this option is all.
value = 'none' solves ordinary differential equations without additional assumptions. The results obtained with this option are correct for all values of the arguments.
Note By default, the solver does not guarantee general correctness and completeness of the results. If you do not set the option IgnoreAnalyticConstraints to none, always verify results returned by the dsolve command. |
If you do not set the value of the option IgnoreAnalyticConstraints to none, the solver applies the following rules to the expressions on both sides of an equation:
The solutions of polynomial equations must be complete.
for all values
of
and
. In particular, the following
equality is valid for all values of
,
, and
:
![]()
for all values
of
and
. In particular, the following
equality is valid for all values of
,
, and
:
![]()
The following equality is valid for all values of
:
![]()
,
,
![]()
,
,
![]()
for all values
of
![]()
The solver can multiply both sides of an equation by any expression except 0.
dsolve('Dx = -a*x')ans = C2/exp(a*t)
The following differential equation presents f as a dependent variable:
dsolve('Df = f + sin(t)')ans = C4*exp(t) - sin(t)/2 - cos(t)/2
dsolve('(Dy)^2 + y^2 = 1','s')ans =
1
-1
(4*tan(C11/4 + s/4)*(tan(C11/4 + s/4)^2 - 1))/(tan(C11/4 + s/4)^2 + 1)^2
(4*tan(C7/4 - s/4)*(tan(C7/4 - s/4)^2 - 1))/(tan(C7/4 - s/4)^2 + 1)^2dsolve('Dy = a*y', 'y(0) = b')ans = b*exp(a*t)
dsolve('D2y = -a^2*y', 'y(0) = 1', 'Dy(pi/a) = 0')ans = exp(a*i*t)/2 + 1/(2*exp(a*i*t))
z = dsolve('Dx = y', 'Dy = -x')z =
x: [1x1 sym]
y: [1x1 sym]Enter z.x and z.y to see the results:
z.x
ans = C20*cos(t) + C19*sin(t)
z.y
ans = C19*cos(t) - C20*sin(t)
By default, the solver applies the set of purely algebraic simplifications that are not correct in general, but that can result in simple and practical solutions:
y = dsolve('Dy=1+y^2','y(0)=1')y = tan(pi/4 + t)
To obtain complete and generally correct solutions, set the value of the option IgnoreAnalyticConstraints to none:
y = dsolve('Dy=1+y^2','y(0)=1',...
'IgnoreAnalyticConstraints','none')y = piecewise([C29 in Z_, tan(pi/4 + t + pi*C29)])
The algebraic simplifications also allow you to obtain solutions for the equations that the solver cannot compute when it uses strict mathematical rules:
dsolve('Dv=19.6-0.00196*v^2','v(0)=0')ans = -(100/exp((49*t)/125) - 100)/(1/exp((49*t)/125) + 1)
versus
dsolve('Dv=19.6-0.00196*v^2','v(0)=0',...
'IgnoreAnalyticConstraints','none') Warning: Explicit solution could not be found. > In dsolve at 104 ans = [ empty sym ]
If dsolve cannot find an analytic solution for an equation, it prints the warning:
Warning: Explicit solution could not be found.
and returns an empty sym object.
![]() | double (sym) | eig | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |