| Symbolic Math Toolbox™ | ![]() |
r = dsolve('eq1,eq2,...', 'cond1,cond2,...',
'v')
r = dsolve('eq1','eq2',...,'cond1','cond2',...,'v')
dsolve('eq1,eq2,...',
'cond1,cond2,...', 'v')
r = dsolve('eq1,eq2,...', 'cond1,cond2,...', 'v') or r = dsolve('eq1','eq2',...,'cond1','cond2',...,'v') symbolically solves the ordinary differential equation(s) specified by eq1, eq2,... using v as the independent variable and the boundary and/or initial condition(s) specified by cond1,cond2,....
The default independent variable is t.
The letter D denotes differentiation with respect to the independent variable; with the primary default, this is d/dx. A 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).
Initial/boundary conditions are specified with 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 initial conditions specified is less than the number of dependent variables, the resulting solutions will contain the arbitrary constants C1, C2,....
You can also input each equation and/or initial condition as a separate symbolic equation. dsolve accepts up to 12 input arguments.
Three different types of output are possible.
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 in lexicographic order 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 will be an equivalent lower order differential equation or an integral.
With no output arguments, dsolve('eq1,eq2,...', 'cond1,cond2,...', 'v') returns a list of solutions.
dsolve('Dx = -a*x') returns
C1*exp(-a*t)
dsolve('Df = f + sin(t)') returns
-1/2*cos(t)-1/2*sin(t)+exp(t)*C1
dsolve('(Dy)^2 + y^2 = 1','s') returns
[ -1] [ 1] [ sin(s-C1)] [ -sin(s-C1)]
dsolve('Dy = a*y', 'y(0) = b') returns
b*exp(a*t)
dsolve('D2y = -a^2*y', 'y(0) = 1', 'Dy(pi/a) = 0') returns
cos(a*t)
dsolve('Dx = y', 'Dy = -x') returns
x: [1x1 sym]
y: [1x1 sym]
If dsolve cannot find an analytic solution for an equation, it prints the warning
Warning: explicit solution could not be found
and return an empty sym object.
![]() | double | eig | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |