You are on page 1of 4

Lab Date: 02.03.

2022

EE3072 LAB Week #2


Grade : ..../50

Name, Surname : Mert Terzi

ID Number : 150718061

OBJECTIVE
To become familiar with the analytical solutions of differential equations using Matlab and
graphical illustrations of the solutions.

BACKGROUND
Using Matlab, it is possible to solve differential equations in two different ways. First, a
symbolic solution by manipulating the symbols in the equation(s) can be obtained much like one
would do with pencil and paper. Second way is to find a numerical answer which may be
approximate. Both have advantages and disadvantages depending on the application.

In this lab, symbolic solutions and their numerical evaluations will be studied. Symbolic Math
Toolbox in Matlab, is required.

Some of the commands mainly to be used in this session are; syms, diff, dsolve and eval.

Analytical vs Numerical Solutions of DEs


In mathematics, some problems can be solved analytically and numerically.

 An analytical solution involves framing the problem in a well-understood form and


calculating the exact solution.
 A numerical solution means making guesses at the solution and testing whether the
problem is solved well enough to stop.

We prefer the analytical method in general because it is faster and because the solution is exact.
Nevertheless, sometimes we must resort to a numerical method due to limitations of time or
hardware capacity.

Consider the following DE 1,

Analytical solution of the given DE 1 can be found as follows

1
Lab Date: 02.03.2022

Think of dy and dx each as discrete variables. So you could do something like multiply both
sides by dx and end up with:

And then divide both sides by y:

Now, integrate the left-hand side dy and the right-hand side dx:

Remember to add the constant of integration, but we only need one.

Raise both sides by e to cancel the ln:

Now, pulling the C out front:

Since C can be either positive or negative, we don't really need the ±:

So there is our general solution: Any constant multiple of is a solution to the differential
equation, which makes sense.

Now, we will solve the same DE 1 by using Symbolic Math Toolbox in Matlab,

clear % just clears the workspace


syms y(x) % define the symbols
eqn1 = diff(y,x) == y; % define the equation
S = dsolve(eqn1) % solve the DE analytically by using dsolve

S=

2
Lab Date: 02.03.2022

PRELIMINARY
 Preliminary study report must be submitted to the ues system before lab begins.

 Submissions via e-mail will not be accepted.

 Convert to pdf file and rename the file as IDNUMBER_Lab2_preliminary.pdf

 If you do not submit your preliminary study report, you will get 0 directly for the related
lab.

 Solve differential equations (DE 2) and (DE 3) analytically on a paper with pencil. Then
take a photo of your solution and paste this image under the related question.
( )
( ) ( ( )) ( )

( )
( ) ( ) ( )

3
Lab Date: 02.03.2022

You might also like