FENG345 Lec3
FENG345 Lec3
Engineers I
Lecture 3
analytical solution:
( )
x = − b b − 4ac / 2a
2
3
Introduction
Root Finding Methods:
• Graphical Method
• Bisection Method (Binary search)
• Secant Method
• Modified Secant
• Successive approximation
• Newton-Raphson method
4
GRAPHICAL METHODS
• A simple method for obtaining an estimate of the root of the equation
𝑓 (𝑥) = 0 is to make a plot of the function and observe where it
crosses the 𝑥 axis.
• It provides a rough approximation of the root.
5
Example
• Use the graphical approach to determine the mass of the bungee
jumper with a drag coefficient of 0.25 𝑘𝑔/𝑚 to have a velocity of
36 𝑚/𝑠 after 4 𝑠 of free fall. Note: The acceleration of gravity is
9.81 𝑚/𝑠 2 .
• The function crosses the m axis between 140 and 150 kg. Visual
inspection of the plot provides a rough estimate of the root of 145 kg.
6
INITIAL GUESSES
• There are a number of general ways that a root may occur in an
interval prescribed by a lower bound 𝑥𝑙 and an upper bound 𝑥𝑢 .
• if the function has different signs at the end points, there will be an
odd number of roots in the interval.
8
INITIAL GUESSES
• There are some exceptions
⁻ Multiple roots that occur when the function is tangential to the x axis.
⁻ Discontinuous functions where end points of opposite sign bracket an
even number of roots.
9
BISECTION METHOD
• If 𝑓(𝑥) is real and continuous in the interval from 𝑥𝑙 to 𝑥𝑢 and 𝑓 𝑥𝑙
and 𝑓 𝑥𝑢 have opposite signs, that is,
10
Example
• Use bisection to solve the same problem approached graphically in
first example.
Solution:The first step in bisection is to guess two values of the
unknown (in the present problem, 𝑚) that give values for 𝑓(𝑚) with
different signs. From the graphical solution, we can see that the
function changes sign between values of 50 and 200.
11
Example
• the new interval extends from 𝑥𝑙 = 125 to 𝑥𝑢 = 200. A revised root
estimate can then be calculated as
• the root is now in the lower interval between 125 and 162.5.
12
Example
• When 𝜀𝑎 becomes less than a prespecified stopping criterion 𝜀𝑠 , the
computation is terminated.
13
BISECTION METHOD
• One of the benefits of the bisection method is that the number of
iterations required to attain an absolute error can be computed before
starting the computation. The absolute error is
14
BISECTION METHOD
• If 𝐸𝑎,𝑑 is the desired error, this equation can be solved for
15
BISECTION METHOD
• Advantage:
- Bisection method always converge no matter how far you start from
the actual root.
• Disadvantage:
- However, it cannot be used to find roots when the function is tangent
to the axis and does not pass through the axis. For example: 𝑓 𝑥 =
𝑥 2.
- Also, it converges slowly compared with other methods.
16
Example
17
3. Roots of polynomials:
Example 3.1 Write the MatLAB program to find the roots of (24x+300+3x2)(-4+5x3+20x)=0
p=
Solution: a1=[3,24,300]; a2=[5,0,20,-4];a=conv(a1,a2),p=roots(a) -4.0000 + 9.1652i
-4.0000 - 9.1652i
15x 5 + 120 x 4 + 1560 x 3 + 468x 2 + 5904 x − 1200 = 0 -0.0990 + 2.0073i
-0.0990 - 2.0073i
0.1981 + 0.0000i
Example 3.2 u ( t ) = −3t 3 + 120 + 60 t Write the MatLAB program to find u(0.4). Do the claculation by a calculator.
Compare the results.
Alternative: a=[-3,0,60,120];u=polyval(a,0.4)
(p.200)
Consider the beam under uniformly distributed load. It is clamped at A and has a roller
Home Excersise 3.4 support at B. The deflection function found with Bernoulli-Euler beam theory is given
q0 below, for the values L=800 mm, q0=10 kN/m. E=200 GPa, I=20 cm4.
% bisect.m
clc,clear,close all
xL=50;xu=200;xr=(xL+xu)/2;epss=0.5/(10^5)*100;kerr=1; ans = 0 18.0000 142.7378
for n=2:1:100;
fr=fx(xr);fL=fx(xL);
if fL*fr>0;xL=xr;end
if fL*fr<0;xu=xr;end
xrp=xr;xr=(xL+xu)/2;
epsa=(xr-xrp)/xr*100;xrp=xr;if abs(epsa)<epss;kerr=0;break;end
end
[kerr,n,xr]
% fx.m
function [f]=fx(x);
f=sqrt(9.81*x/0.25).*tanh(sqrt(9.81*0.25./x)*4)-36;
Solution: 9.81
Home Excercise 3b.1 1 = 90(tan 0 ) − (8100) + 1.8
( 2)(900) cos 0
2
44.145
f = 90(tan x ) − 2
+ 0 .8 = 0
cos x
th0=0:1:80;x=th0;f=fx(x);plot (x,f)
% bisect.m
clc,clear,close all
xL=30;xu=45;xr=(xL+xu)/2;epss=0.5/(10^5)*100;kerr=1;
for n=2:1:100;
fr=fx(xr);fL=fx(xL);
if fL*fr>0;xL=xr;end
if fL*fr<0;xu=xr;end
xrp=xr;xr=(xL+xu)/2;
epsa=(xr-xrp)/xr*100;xrp=xr;
if abs(epsa)<epss;kerr=0;break;end
end
[kerr,n,xr]
% fx.m
function [f]=fx(x); x=0.5671
f=exp(-x)-x;
Example 3.3 Consider the mass-spring-dashpot system. The mathematical model is given as mx + kx = f − cx
x(t) The governing difeferential equation can be organized as: mx + cx + kx = f
For the free vibration under initial conditions f=0. Then, mx + cx + kx = 0
k
m Try the free vibration solution as x(t)=est.
f ( t ) Applying the solution to the differential equation gives ms 2 e st + cse st + ke st = 0
c
Eigenvalue equation can be obtained as ms 2 + cs + k = 0
a) Take m=2, c=60, k=280. Write the MatLAB program to find the eigenvalues. Also, find the eigenvalues by the calculator.
Compare the results. Write the form of the free vibration response.
b) Take m=2, c=30, k=280. Write the MatLAB program to find the eigenvalues. Also, find the eigenvalues by the calculator.
Compare the results. Write the form of the free vibration response.
Solution: a) d=[2,60,280];p=roots(d) 2s + 60s + 280 = 0
2 − 60 60 2
− 4( 2)(280) s1 = −24.2195, s 2 = −5.7805
s1, 2 =
2( 2)
The form of free vibration: x(t)=A1e -24.2195t +A2e -5.7805t A1 and A2 are determined by initial conditions
− 30 30 2 − 4( 2)(280) s = −7.5 + 9.1515i, s = −7.5 − 9.1515i
b) d=[2,30,280];p=roots(d) 2s + 30s + 280 = 0
2
s1, 2 = 1 2
2( 2)
The form of free vibration: x(t)=Ae-7.5tcos(9.1515t-ϕ) A and ϕ are determined by initial conditions
Example 3.4 Consider the problem given in Example 3.2. If f(t)=est, the reponse can be x(t)=H(s)est.
Then, from the differential equation: ms 2 Hest + csHest + kHest = est
1
The transfer function can be found as: H (s) =
ms 2 + cs + k
a) Write the form of the steady state response for the values given in Example 3.2 (a)
b) Write the form of the steady state response for the values given in Example 3.2 (b)