Midterm LATEX 2023
Midterm LATEX 2023
Engineering Faculty
Electrical & Electronics Engineering
EEE 1007 Computer Programming I
Midterm - Fall 2023
Algorithm 1 Bisection
1: procedure Bisection
2: Step 1: Initialization:
3: Determine and Initialize aa and ab when aa < ab . Initialize tolerance value (ε = 10−4 )
4: k = 1 (Iteration Index)
5: Step 2: Update Rule
6: ak = aa + ab −a
2
a
7: Step 3:
0
8: if f ak = 0 then
9: terminate the iteration owing to convergence
10: else if (ab − aa ) < ε then
11: terminateiteration
due to tolerans value(ε)
0 0
12: else if f ak f aa > 0 then
13: aa = ak
14: else
15: ab = ak
16: k ← k + 1 goto Step 2.
17: Step 4: Obtain solution:
• Prepare a report containing Matlab m-file codes, the above figures and information about Bisec-
tion algorithm. [35-marks]
• Do not forget to upload the report and matlab m-files to the DYS system link given for midterm
exam.
• Do not forget to submit you report about the midterm at exam to exam observer, and do not
forget to sign to the exam attendance list.
The sample figure is illustrated in Figure 1 for implementation and report. The following references
can be refered for more detailed information about Bisection.
1. A. Ravindran, K.M. Ragsdell, G.V. Reklaltis ,”Engineering Optimization: Methods and Appli-
cations”, Second Edition (Chapter 2.5.2 Bisection Method)
Page 2
2
-0.5 f(x[k])
ple
1.5 fx[k] -0.55
le
S am δ f[k] -0.6
a mp
1
2 4
S6 8 10 12 14
le
0.5
amp mp
le
S le a
amp 0 S
mp
le
0 S a δ f[k]
-0.5 S
-0.5 -1
2 4 6 8 10 12 14
le
mp le
-1 2.7
S a 2.6 a mp
-1.5 S x[k]
2.5
-2 2.4
0 0.5 1 1.5 2 2.5 3 3.5 2 4 6 8 10 12 14
x [k]
2
fx [k]
1.5 le δ f[k]
amp
1 S
mp le
Sa
0.5
m ple
0 Sa
-0.5
le
-1
amp
S
-1.5
-2
0 0.5 1 1.5 2 2.5 3 3.5
x
Page 3