- Home
- Project Description
- Authors
- Differential Equations
with MATLAB
- Differential Equations
with Mathematica
- Differential Equations
with Maple
|
Differential Equations with MATLAB
Series Solutions in MATLAB 2020a and later
As of MATLAB 2020a, the ability to request series solutions
to differential equations using dsolve now exists,
but the syntax is slightly different from what we guessed it would
be when the 2019 edition of Differential Equations with MATLAB
was written. On this page, we explain the correct syntax and
give some actual examples.
To request a series solution to a differential equation
using dsolve, begin with the ordinary dsolve
code, but add 'ExpansionPoint' followed by the
point around which one wants a series solution. Usually this will
be the point at which the initial condition is specified.
Specify 'Order' to change the
number of terms in the series, just as you would with the
series command. We give a number of examples.
- ♦ Solving y' = y with initial condition y(0)=1.
The solution is the exponential function.
-
- syms y(t); dsolve(diff(y)==y, y(0)==1, 'ExpansionPoint', 0)
-
- This produces the output
-
- ans =
-
- t^5/120 + t^4/24 + t^3/6 + t^2/2 + t + 1
- ♦ Finding the series expansion of the Bessel function J0
by solving Bessel's equation with initial conditions
y(0)=1, y'(0)=0. Note that since the solution is
even, we need a higher order to get a reasonable number of terms.
-
- dsolve(t^2*diff(y,2) + t*diff(y) + t^2*y == 0, y(0)==1, ...
- subs(diff(y),t,0)==0, 'ExpansionPoint', 0, 'Order', 8)
-
- This produces the output
-
- ans =
-
- - t^6/2304 + t^4/64 - t^2/4 + 1
-
- ♦ Solving 2ty'' + y' + ty = 0 in
Frobenius series around t = 0.
-
- dsolve(2t*diff(y,2) + diff(y) + t*y == 0, ...
- 'ExpansionPoint', 0)
-
- This produces the output
-
- ans =
-
- t^4/168 - t^2/6 + 1
- t^(1/2) - t^(5/2)/10 + t^(9/2)/360
|