Current location - Training Enrollment Network - Mathematics courses - How to use mathematical physics method (numerical method)?
How to use mathematical physics method (numerical method)?
First, the theoretical solution is to use the dsolve function (enter doc dsolve in the command window to view help).

Example:

Code:

[x,y]= dsolve(' D2x+2 * Dx = x+2 * y-exp(-t)',' Dy=4*x+3*y+4*exp(-t)')

Second, the numerical solution, using ode45, or ode23, ode 15s and other functions. (enter doc ode45 in the command window to view help. )

Example:

1. Create M file

Function dy=vdp(t, y)

dy =[y(2);

1000*( 1-y( 1)^2)*y(2)-y( 1); ];

2. Call MATLAB function ODE 15S.

[T,Y]=ode 15s('vdp ',[0 1000],[2 0]);

plot(T,Y(:, 1));

The image is: