Module 3
Module 3
Optimisation
KE27003 Computational Engineering
Topic
Optimisation
1 2
Newton- Perturb-and-
Raphson Observe
Newton-Raphson (NR)
Is an iterative root-finding method, which is used to find the roots of
equations through a repetitive process.
It involves refining initial guesses to approximate the roots of functions, often
used in numerical analysis.
This iterative approach is crucial for solving complex equations where exact
solutions are difficult to obtain.
Concept
Derivation
Given: function
Methodology:
Determine the derivative of function , or called as
gradient / slope of the curve at
2
(may use calculator)
f(x)
1
-1
-2
0 0.5 1 1.5 2 2.5 3
x
Example: Root Determination (NR)
Determine the roots for the function, using Newton-Raphson method.
Function f(x) = x 3 - 4x 2 + 5x - 2
4
3
First guess :
1st iteration : 2
2nd iteration :
f(x)
1
3rd iteration : 43
4th iteration : 00 0
-1
Root:
-2
0 0.5 1 1.5 2 2.5 3
x
What is the difference between manual calculation
and Newton-Raphson method?
Example: Matlab Coding (Root)
Determine the roots for the function, using Newton-Raphson method.
Function f(x) = x 3 - 4x 2 + 5x - 2
4
f(x)
1
-1
-2
0 0.5 1 1.5 2 2.5 3
x
1st Derivation:
2
Optimum point occurred at , thus
or
f(x)
1
0
2nd
Derivation:
If , , : maximum point @ -1
If , , : minimum point @
-2
0 0.5 1 1.5 2 2.5 3
x
Example: Optimum Point (NR)
Determine the optimum points for the function, using Newton-Raphson method.
Function f(x) = x 3 - 4x 2 + 5x - 2
𝒇 ′ ( 𝒙 𝒏) 4
𝒙 𝒏+𝟏 = 𝒙 𝒏 − ′′
𝒇 ( 𝒙 𝒏)
3
First guess :
1st iteration : 2
2nd iteration :
f(x)
1
3rd iteration :
4th iteration : 0
-1
Optimum point:
-2
0 0.5 1 1.5 2 2.5 3
x
Example: Matlab Code (Optimum
Point)
Determine the optimum points for the function, using Newton-Raphson method.
Function f(x) = x 3 - 4x 2 + 5x - 2
4
f(x)
1
-1
-2
0 0.5 1 1.5 2 2.5 3
x
Example (Diode Current)
Determine the voltage across a diode at which the current flow through it is . Given that
, and
Pros Cons
• Efficient in finding the root of an • Sensitive to the choice of initial guess.
equation.
• May diverge if the derivative is close to
• Converges rapidly if the initial guess is zero.
close to the root.
• Not suitable for all types of functions.
• Requires less memory and
computational effort.
Exercise 1 (Nodal Analysis)
Determine the voltage, .
Steps to simulate the voltage, :
𝑉a
0 1. Derive the equation for based on Kirchhoff’s law.
+ 𝑅1 s
2. Rearrange the equation in the form as .
𝑅2 𝑅3
3. Determine the equation for .
a
0 4. Guess the initial value of .
s
5. Use Newton-Raphson method to determine the value
of .
Motion:
Source: Wikipedia
Perturb-and-Observe
Algorithm
Perturb and Observe (P&O)
Algorithm
An algorithm used to determine the maximum point.
90
Case 3:
80
If AND
70
Then
60
Case 1:
50
If AND
Output
40 −∆𝑥 Case 4:
Then
30 If AND
Case 2: 20
Then
If AND +∆ 𝑥
𝑥∆𝑥
10
− ∆+
Then 0
0 5 10 15 20 25
Current Input Current
Flowchart Start
Yes No
Is ?
Yes No Yes No
Is ? Is ?
End
Weakness of P&O Algorithm
Exercise
1. What are the impacts of high ?
4. How to modify P&O algorithm so that it can be used to determine minimum point?
Exercise
12
where
10
0
-3 -2 -1 0 1 2 3