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

ISLAMIC UNIVERSITY OF TECHNOLOGY (IUT)

ORGANISATION OF ISLAMIC COOPERATION (OIC)


DEPARTMENT OF ELECTRICAL AND ELECTRONIC
ENGINEERING

NAME : Tasnia Nafs


STUDENT ID : 200021113
DEPARTMENT : ELECTRICAL AND ELECTRONIC ENGINEERING (EEE)
SECTION & GROUP : A1

DATE OF SUBMISSION : October 3, 2023

❖ Waveshapes:

COURSE NO. : EEE 4506


COURSE TITLE : Numerical Lab
EXPERIMENT NO : 4
NAME OF EXPERIMENT : Introduction to Secant method
Explain the difference between the secant method and the other techniques that you have learned so
far for approximating the roots.

The secant method is a numerical root-finding technique that differs from other methods like the
bisection method and Newton's method in several ways: In the secant method, instead of requiring an
interval with known opposite signs (as in the bisection method) or an initial guess and its derivative (as
in Newton's method), it starts with two initial guesses, often relatively close to the root. The secant
method typically converges faster than the bisection method (which is linear convergence) but slower
than Newton's method (which is quadratic convergence). It approaches the root in a more gradual,
curving manner. Unlike Newton's method, the secant method does not require the computation of
derivatives, making it applicable to functions where finding derivatives may be challenging or
impractical.

Modified Secant method-Task-2


clc
clear all
close all
format long
q=@(x) exp(-x)-x;

fplot(q,[0.5,0.7])
hold on
yline(0,'-g');
hold off
n=input('Enter significant digit');

Es=(0.5*10^(2-n))
Es =
0.050000000000000
ea=100;
x0=1; %represents x_0
dx=-1;
while ea>Es
a=a+1;
x1=x0-q(x0)*dx/(q(x0+dx)-q(x0));
dx=x1-x0;
ea=abs(((x1-x0)/x1)*100);
x0=x1;
end
x1
ans =
0.567143143476009
Secant method -task-3
clc
clear all
close all
format long
q=@(x) 0.95*x^3-5.9*x^2+10.9*x-6;
fplot(q,[0,5])

hold on
yline(0,'-g');
hold off

n=input('Enter significant digit');

Es=(0.5*10^(2-n))
Es =
0.050000000000000
x0= 2.5; % x(i-1)
x1= 3.5; % x(i)
ea=100;
while ea>Es
x2=x1-q(x1)*(x0-x1)/(q(x0)-q(x1)); %x(i+1)
ea=abs((x2-x1)*100/x2);
x0=x1;
x1=x2;
end
double(x1)
ans =
3.344613047176974

You might also like