School of Engineering and Computer Science Department of Electrical & Electronic Engineering

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Independent University, Bangladesh

School of Engineering and Computer Science


Department of Electrical & Electronic Engineering

Course ID EEE-314L

Course Title Numerical Technique Lab

Student Name MD AKIF RAHMAN

Student ID 1711396

Experiment No: 05
Experiment Name: Study on solving Differential Equation using Euler Method.
Objectives:
➢ To get introduced with basic MATLAB commands to perform Eulers Method.
➢ Perform Eulers Method on given examples.
➢ Verify MATLAB output with the theoretical hand calculations.

Apparatus:
➢ MATLAB

Theory: (In Short)


• Differential Equations
A differential equation is an equation which contains one or more terms and the derivatives of one variable (i.e.,
dependent variable) with respect to the other variable (i.e., independent variable)
dy/dx = f(x)
Here “x” is an independent variable and “y” is a dependent variable
For example, dy/dx = 10x

A differential equation contains derivatives which are either partial derivatives or ordinary
derivatives. The derivative represents a rate of change, and the differential equation describes a
relationship between the quantity that is continuously varying with respect to the change in
another quantity.
• Euler Method
Euler's method is used for approximating solutions to certain differential equations and works by
approximating a solution curve with line segments.
In some cases, it's not possible to write down an equation for a curve, but we can still find approximate
coordinates for points along the curve by using simple lines. These line segments have the same slope as the
curve, so they stay relatively close to it. Euler's method is useful because differential equations appear frequently
in physics, chemistry, and economics, but usually cannot be solved explicitly, requiring their solutions to be
approximated. For example, Euler's method can be used to approximate the path of an object falling through a
viscous fluid, the rate of a reaction over time, the flow of traffic on a busy road, to name a few.
Equations:

𝑌𝑛+1 = 𝑌𝑛 + ℎ𝑓(𝑋𝑛 )
h = Step size
f(x) = differential equation

MATLAB Code:
Code for Single N points

Code for Multiple N points


Experiments:
Write down appropriate MATLAB code to solve the following Equations using Euler’s Method
• Equations
a. 𝑦 = 3𝑥 5
b. 𝑦 = cos(𝑥 2 )
c. 𝑦 = 2𝑥 + 𝑒 −2𝑥
Find y(5) and pints N = 5, 10, 20, 30
Calculations:
Do the hand written calculation for all the equations when N = 5.
Discussion:
Write down the procedure you followed to do the experiments(in short) and short result analysis.

This experiment in on the graphical visualization of Euler Method solved derivation. if we break
down the MATLAB code, we can see at first the code started with declaring the interval which
starts from t0=0 to t5=5. Number of Y values are set to 5 for single N point. The common
distance between the points or step size h = (t0−t)/N is given as the equation. Initial Y(1) is
solved by hand from the given equation.

After that a “for” loop is introduced as the body of the function there the 1st order derived
solving is written from the given function. In next line the main Euler method equation is written
to conduct the derived function. “end” ends the loop.

To see the graph at first ‘plot(x,y)’ is written to set graph in 2D x and y axis. In following line
‘plot(x,y(i+1))’ sets the mesh points in x vs. new y. Legend function creates descriptive labels for
plotted data series in the form of 'Approximate','Exact'. 2 lines will be formed where the blue line
is continuous approximation to the solution y(t) and the red line will be the exact solution. As
Euler method focuses on the approximation of y(t) so the comparison is showed for error rate on
Approximate values from graph and calculation.

In Multiple point code two loops are intertwined in one another to avoid the writing each code
separately for every points. 1st loop of “for” will run via the “length” of N to run the loop for
that many times. “j” will specify the length for step size. 2nd loop of “for” will run inside the 1st
loop to solve the Euler equation.

From result analysis we can see that the values of both theoretical and graphical are same in 3x5
and cos(x2 ) but had a slight shift in error percentage in 2x+e -2x . It happened because of
calculating with approximate answers after point.
LAB REPORT RUBRICS

Student Name MD AKIF RAHMAN Student ID 1711396


Course Title Numerical Technique Lab Course Code EEE 314L
Term Spring Summer Autumn Year 2022
Experiment Study on solving Differential Equation using Experiment
05
Name Euler Method Number
Submission
17-July,2022 Due Date 11-July,2022
Date
Tick () on the appropriate box (any one from 1 to 5)
Rubrics (weight) Accomplished Intermediate Developing Intermediate Novice
(5) (4) (3) (2) (1)
Understanding Defined experiment Intermediate Defined Intermediate Defined
experiment’s requirements and between experiment between novice experiment
requirements assume circuit developing requirements and and developing. requirements and
(25%) specifications, if any, and assume circuit assume circuit
properly. accomplished. specifications, if specifications, if
any, moderately. any, poorly.

Building Circuit Conducted Intermediate Conducted Intermediate Conducted


and conducting experiment properly between experiment between novice experiment
experiment (25%) by building developing & moderately by and developing. poorly by
simulation circuit accomplished. building building
using required simulation circuit simulation circuit
specification. using required using required
specification. specification.

Result and Analyzed and Intermediate The results are Intermediate The results are
analysis (25%) interpreted the results between analyzed to some between novice analyzed poorly
properly using the developing extent according and developing. due to
converter parameters. and to specified incomplete
accomplished. requirements. simulation.

Remarks / Answered the given Intermediate Answered Intermediate Answered the


Answering questions correctly between partially the given between novice given questions
Question (25%) and describe the developing questions and and developing. incorrectly and
remarks properly. and describe the describe the
accomplished. remarks remarks poorly.
moderately.

Sub Total 80
Deduction for late
submission / any
other issue
Total (100%)
10% of Total

You might also like