Lecture Module 2 Presentation
Lecture Module 2 Presentation
ENGINEERING MATHEMATICS 4
Linear equations:
In engineering (for example in Control) solving the roots is called solving Zeros
Therefore, the variables resulting zero values of the function must be found.
x=?
x=?
Plotting the the nonlinear function, then you will see the zeros
0.3
(negative)
1
If you try x = 1
(positive)
Conclusion : The roots (zeros) occurs between negative and positive results
or y3(0,3) multiply by y3(1) is negative
Mathematical expression:
First trial
In Bisection Method,
Method it used the idea of Intermediate Value Theorem and introduces the
predicted root by dividing the interval [a ,b] into two sections equally c=(a+ b)/2
a b
c=(a+ b)/2
c=(a+ b)/2
a b
c=(a+ b)/2
f (c) f (b)< 0 ? NO
a b=c
c=(a+ b)/2
f = inline(f);
if (f(a) * f(b) > 0) || (a >= b)
error('INCORRECT INPUT f(a)*f(b)>0 or a>=b');
end
6
Given a system a response following a function y ( x)= x − x−1
a) Find a system at a stable condition (zero) in range [1,2] using bisection method.
Stop your prediction when the error (convergence criteria) less then 0.0005
b) Verify your calculation by plotting the function, and show your predicted result is correct
B. Add
D. Restart FreeMat
by its tangential line. This tangential line (or slope) is the first derivative y ' ( x)
y ( x) − y ( x o)
root = y ' ( x o)
x1− xo
− y ( x o )= y ' ( x o )( x 1 − x o )
xo x1 x
− y ( x o )= y ' ( x o ) x 1 − y ' ( x o ) x o
y ' ( x o)
y ' ( x o ) x 1= y ' ( x o ) x o − y ( x o )
y ( xo)
y ( xo ) x 1 = x o−
y ' ( x o)
y ( xo)
x 1 = x o− is then expressed in general rule
y ' ( x o)
y ( xi )
x i+ 1 = x i −
y ' ( xi )
y ( xi )
x i+ 1 = x i −
y ' ( xi )
6. Return to Step 3
format long;
func = inline(func);
dfunc = inline(dfunc);
if nargin == 3
tol = 1.0e6*eps;
end
for i = 1:1000
dx = -(func(x)/dfunc(x));
x = x + dx;
if abs(dx) < tol
root = x;
numIter = i;
return
end
end
fprintf('more then 1000 trial, too small tolerance /n')
6
Given a system a response following a function y ( x)= x − x−1
Stop your prediction when the error (convergence criterion) less then 0.00001
b) Verify your calculation by plotting the function, and show your predicted result is correct
y ( x i+ 1 ) y( xi+ 1 ) ( x i − x i+ 1 )
x i+ 2 = xi+ 1 − x i+ 2 = xi+ 1 −
y ' ( xi+ 1 ) y( x i )− y( x i+ 1 )
x i y( x i+ 1 )− x i+ 1 y( x i )
x i+ 2 = i=0,1,2,⋯n
y ( x i+ 1 )− y( x i )
x i y( x i+ 1 )− x i+ 1 y( x i )
x i+ 2 = i=0,1,2,⋯n
y ( x i+ 1 )− y( x i )
To implement the iteration, it requires two points that satisfy the intermediate
value theorem. One has positive value and the other one must be negative.
y ( x)
x 0 y( x1 )− x 1 y( x 0 )
x2= root
y ( x 1 )− y ( x 0 ) y ( x1)
Table data
xo x2
Iteration x
(i)
xi y ( xi) x1
0 x0 y ( x0 )
1 x1 y ( x 1)
2 x2 y ( xo )
BDA34003 Engineering Mathematics 4 28
Waluyo Adi Siswanto ([email protected])
How to find the roots (Zeros) ?
Secant Method
0 x0 y ( x0 )
1 x1 y ( x 1)
STEP 1
2 x2
x 0 y( x1 )− x 1 y( x 0 )
x2=
y ( x 1 )− y ( x 0 )
0 x0 y ( x0 )
STEP 3
1 x1 y ( x 1)
2 x2
x 0 y( x1 )− x 1 y( x 0 )
x2=
y ( x 1 )− y ( x 0 )
x 0 y( x1 )− x 1 y( x 0 )
3. Do the calculation of x2=
y ( x 1 )− y ( x 0 )
format long;
f=inline(f);
older = x0; old = x1;
folder = f(older);
Nmax=1000;
for i = 2 : Nmax
fold = f(old);
dx = fold * ( old - older ) / ( fold - folder );
new = old - dx;
numIter=i;
if ( abs(dx) < TOL )
return
else
older = old;
old = new;
folder = fold;
end
numIter=i;
end
6
Given a system a response following a function y ( x)= x − x−1
Stop your prediction when the error (convergence criterion) less then 0.00001
b) Verify your calculation by plotting the function, and show your predicted result is correct
6 3
Two nonlinear functions y ( x)= x − x−1 g ( x)=−x +5
6 3
A new function should be defined f ( x)= y( x)− g ( x)= x − x−1+ x −5
6 3
f ( x)= x − x−1+ x −5
An object moves following a nonlinear function, the distance (y) is depending on the time (t)