0% found this document useful (0 votes)
73 views

STR N 215 - Computational Engineering: Lecture No. 1 Moment Curvature Analysis

This document provides an overview of the Computational Engineering course STR N 215. It discusses the course objectives, methods and tools used including finite element software and numerical software. It also outlines the course evaluation criteria and applications including fiber analysis, modal analysis, and stiffness analysis. Finally, it provides an introduction to moment curvature analysis, describing the assumptions, approach, and an example problem to calculate moment and curvature for a reinforced concrete beam.

Uploaded by

Ibrahim Adel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

STR N 215 - Computational Engineering: Lecture No. 1 Moment Curvature Analysis

This document provides an overview of the Computational Engineering course STR N 215. It discusses the course objectives, methods and tools used including finite element software and numerical software. It also outlines the course evaluation criteria and applications including fiber analysis, modal analysis, and stiffness analysis. Finally, it provides an introduction to moment curvature analysis, describing the assumptions, approach, and an example problem to calculate moment and curvature for a reinforced concrete beam.

Uploaded by

Ibrahim Adel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 159

STR N 215 – Computational

Engineering
Lecture No. 1
Moment Curvature Analysis

1 STR N 215 – Computetional Enginnering 3/24/2019


Course Instructor
• Dr. Mostafa M. ElSayed
E-mail: [email protected]
• Eng. Ahmed Ismail

2 STR N 215 – Computetional Enginnering 3/24/2019


Course Objectives
• Understanding the fundamentals of numerical analysis techniques.
• Understanding and mastering how to create a program

Methods and Tools


• Finite element software ( ex. SAP).
• Numerical software (EXCEL – MATLAB).

3 STR N 215 – Computetional Enginnering 3/24/2019


Course evaluation
• Final exam 40%.
• Midterm 20 %.
• Quizzes 20%.
• Assignments 10%.
• Class work 10%.

4 STR N 215 – Computetional Enginnering 3/24/2019


Course applications
• Fiber analysis of
• Beams
• Columns
• Slabs
• Pre-stressed sections

• Modal analysis of structures


• Stiffness analysis of trusses

5 STR N 215 – Computetional Enginnering 3/24/2019


Moment-Curvature Analysis
• Assumptions and limitations:
• Strain profile is linear at all stages of loadings up to ultimate.

• Steel strain and concrete strain at a given distance from neutral axis are
identical.

• Constitutive models for concrete and reinforcement bars are known.

• Axial force (if any) can be considered

6 STR N 215 – Computetional Enginnering 3/24/2019


Moment-Curvature Analysis
• For a typical cross-section, with given
materials’ constitutive models and axial
load:
1. Divide the section into many fibers. As
such, the properties of each is known.
2. Assume an initial strain at the top extreme
fiber.
3. Assume the location of neutral axis and
check it from equilibrium.
4. Calculate moment and curvature
5. Increase upper strain and repeat

7 STR N 215 – Computetional Enginnering 3/24/2019


Moment-Curvature Analysis
• In excel language, we need goal seek
“next lecture”.
• Repetitive technique to create many
moment-curvature combinations “for
loop”
• Numerical integration to convert
curvature into deformation and moment
into load

8 STR N 215 – Computetional Enginnering 3/24/2019


Moment-Curvature Analysis “example”
• For a reinforced concrete beam (25 cm x 60 cm) with bottom
reinforcement (3 T 16) and upper reinforcement (2 T 12) as
shown, use fiber model technique to and divide the concrete
cross-section into 60 fibers:
• Calculate the moment and curvature that can be withstood by this
beam for upper strain = 0.0035.

9 STR N 215 – Computetional Enginnering 3/24/2019


Moment-Curvature Analysis “example”
500 fs  f y
400
Stress (fs )
300
200
100 f s  Es  e s
30
0
-0.006 -100 0 0.006 25
Strain (es)
-200
20
-300  2e c  e c  

Stress (fc )
2

-400 15 f c  f cu    
 0 . 002  0 . 002  
-500
10
f c  f cu
5
fcu = 25 MPa and fy = 400 MPa f c  0 .0
0
0 0.002 0.004 0.006
Strain (ec)
10 STR N 215 – Computetional Enginnering 3/24/2019
11 STR N 215 – Computetional Enginnering 3/24/2019
STR N 215 – Computational
Engineering
Lecture No. 2
MATLAB Fundamentals

12 STR N 215 – Computetional Enginnering 3/24/2019


The MATLAB Environment
• MATLAB uses three primary windows-
 Command window - used to enter
commands and data
 Graphics window(s) - used to display plots
and graphics
 Edit window - used to create and edit M-
files (programs)
• Depending on your computer platform
and the version of MATLAB used, these
windows may have different looks and
feels.
13 STR N 215 – Computetional Enginnering 3/24/2019
Calculator Mode
• The MATLAB command widow
can be used as a calculator
where you can type in
commands line by line.
Whenever a calculation is
performed, MATLAB will
assign the result to the built-in
variable ans
• Example:
>> 55 - 16
ans =
39
14 STR N 215 – Computetional Enginnering 3/24/2019
MATLAB Variables
• While using the ans variable may be useful for performing quick
calculations, its transient nature makes it less useful for programming.
• MATLAB allows you to assign values to variable names. This results in
the storage of values to memory locations corresponding to the variable
name.
• MATLAB can store individual values as well as arrays; it can store
numerical data and text (which is actually stored numerically as well).
• MATLAB does not require that you pre-initialize a variable; if it does not
exist, MATLAB will create it for you.

15 STR N 215 – Computetional Enginnering 3/24/2019


Scalars
• To assign a single value to a variable, simply type the variable name, the =
sign, and the value:
>> a = 4
a =
4
• Note that variable names must start with a letter, though they can contain
letters, numbers, and the underscore ( _ ) symbol

16 STR N 215 – Computetional Enginnering 3/24/2019


Scalars (cont’)
• You can tell MATLAB not to report
the result of a calculation by
appending the semi-solon (;) to the
end of a line. The calculation is still
performed.
• You can ask MATLAB to report the
value stored in a variable by typing
its name:

17 STR N 215 – Computetional Enginnering 3/24/2019


Arrays, Vectors, and Matrices
• MATLAB can automatically handle
rectangular arrays of data - one-
dimensional arrays are called vectors
and two-dimensional arrays are
called matrices.
• Arrays are set off using square
brackets [ and ] in MATLAB
• Entries within a row are separated by
spaces or commas
• Rows are separated by semicolons
18 STR N 215 – Computetional Enginnering 3/24/2019
Arrays, Vectors, and Matrices (example)
• >> a = [1 2 3 4 5 ]
a =
1 2 3 4 5
>> b = [2;4;6;8;10]
b =
2
4
6
8
10
• Note 1 - MATLAB does not display the brackets

19 STR N 215 – Computetional Enginnering 3/24/2019


Arrays, Vectors, and Matrices
• A 2-D array, or matrix, of data is
entered row by row, with spaces (or
commas) separating entries within
the row and semicolons separating
the rows:
>> A = [1 2 3; 4 5 6; 7
8 9]
A =
1 2 3
4 5 6
7 8 9

20 STR N 215 – Computetional Enginnering 3/24/2019


Useful Array Commands
• The transpose operator (apostrophe)
can be used to flip an array over its
own diagonal. For example, if b is a
row vector, b’ is a column vector
containing the complex conjugate of
b.

21 STR N 215 – Computetional Enginnering 3/24/2019


Array Creation - linspace
• To create a row vector with a specific
number of linearly spaced points
between two numbers, use the
linspace command.
• linspace(x1, x2, n) will
create a linearly spaced array of n
points between x1 and x2

22 STR N 215 – Computetional Enginnering 3/24/2019


Array Creation - logspace
• To create a row vector with a specific
number of logarithmically spaced
points between two numbers, use the
logspace command.
• logspace(x1, x2, n) will
create a logarithmically spaced array
of n points between 10x1 and 10x2
>>logspace(-1, 2, 5)
ans =

23 STR N 215 – Computetional Enginnering 3/24/2019


Mathematical Operations
• Mathematical operations in MATLAB can be performed on both scalars and
arrays.
• The common operators, in order of priority, are:
• ^ Exponentiation 4^2 = 8
- Negation -8 = -8
(unary operation)
* Multiplication and 2*pi = 6.2832
/ Division pi/4 = 0.7854

\ Left Division 6\2 = 0.3333


+ Addition and 3+5 = 8
- Subtraction 3-5 = -2
24 STR N 215 – Computetional Enginnering 3/24/2019
Order of Operations
• The order of operations is set first by ^ Exponentiation
parentheses, then by the default order given - Negation
above: (unary operation)
* Multiplication and
 y = -4 ^ 2 gives y = -16 / Division
since the exponentiation happens first due to its
higher default priority, but \ Left Division
 y = (-4) ^ 2 gives y = 16 + Addition and
since the negation operation on the 4 takes place - Subtraction
first

25 STR N 215 – Computetional Enginnering 3/24/2019


Plot with Matlab
• If you have two
vectors (arrays):

• plot (x,y)

26 STR N 215 – Computetional Enginnering 3/24/2019


Programming With MatLAB
• Using the editor window (M-file)

27 STR N 215 – Computetional Enginnering 3/24/2019


M-file
• While commands can be entered directly to the command window,
MATLAB also allows you to put commands in text files called M-files.
M-files are so named because the files are stored with a .m extension.

• There are two main kinds of M-file


 Script files (main program)
 Function files (subroutines)

28 STR N 215 – Computetional Enginnering 3/24/2019


Structured Programming
• Structured programming allows MATLAB to make decisions or
selections based on conditions of the program.

• Decisions in MATLAB are based on the result of logical and relational


operations and are implemented with if, if…else, and
if…elseif structures.

• Selections in MATLAB are based on comparisons with a test


expression and are implemented with switch structures.

29 STR N 215 – Computetional Enginnering 3/24/2019


Relational Operators
Example Operator Relationship
x == 0 == Equal
unit ~= ‘m’ ~= Not equal
a<0 < Less than
s>t > Greater than
3.9 <= a/3 <= Less than or equal to
r >= 0 >= Greater than or equal to
 ~x (Not): true if x is false (or zero); false otherwise
 x & y (And): true if both x and y are true (or non-zero)
30 STR N 215 – Computetional Enginnering 3/24/2019
Decisions
• Decisions are made in MATLAB using if structures, which may also
include several elseif branches and possibly a catch-all else
branch.
• Deciding which branch runs is based on the result of conditions which
are either true or false.
 If an if tree hits a true condition, that branch (and that branch only) runs, then
the tree terminates.
 If an if tree gets to an else statement without running any prior branch, that
branch will run.

31 STR N 215 – Computetional Enginnering 3/24/2019


Loops
• Another programming structure involves loops, where the same lines of
code are run several times. There are two types of loop:
 A for loop ends after a specified number of repetitions established by the number of
columns given to an index variable.
 A while loop ends on the basis of a logical condition.

• One common way to use a for…end structure is:


for index = start:step:finish
statements
end

where the index variable takes on successive values in the vector created
using the : operator.

32 STR N 215 – Computetional Enginnering 3/24/2019


Loops
• A while loop is fundamentally different from a for loop since while
loops can run an indeterminate number of times. The general syntax is
while condition
statements
end
where the condition is a logical expression. If the condition
is true, the statements will run and when that is finished, the loop
will again check on the condition.
• Note - though the condition may become false as the
statements are running, the only time it matters is after all the
statements have run.
using the : operator.
33 STR N 215 – Computetional Enginnering 3/24/2019
Roots: Bi-section Method

34 STR N 215 – Computetional Enginnering 3/24/2019


Roots
• “Roots” problems occur when some function f can be written in terms
of one or more dependent variables x, where the solutions to f(x)=0
yields the solution to the problem.

• These problems often occur when a design problem presents an


implicit equation for a required parameter.

35 STR N 215 – Computetional Enginnering 3/24/2019


Graphical Methods
• “A simple method for obtaining the estimate of the root of the
equation f(x)=0 is to make a plot of the function and observe where
it crosses the x-axis.
• Graphing the function can also indicate where roots may be and
where some root-finding methods may fail:
a) Same sign, (no roots, even number of roots)
b) Different sign, (one root, odd number of roots)

36 STR N 215 – Computetional Enginnering 3/24/2019


Graphical Methods
5000

4000
Summation of “F” (kN)

3000

2000

1000

0
0 200 400 600 800 1000
-1000
Location of N.A. (mm)
37 STR N 215 – Computetional Enginnering 3/24/2019
Bracketing Methods
• Bracketing methods are based on making two initial guesses that
“bracket” the root - that is, are on either side of the root.

• Brackets are formed by finding two guesses xl and xu where the sign of
the function changes; that is, where f(xl ) f(xu ) < 0

• The incremental search method tests the value of the function at


evenly spaced intervals and finds brackets by identifying function sign
changes between neighboring points.

38 STR N 215 – Computetional Enginnering 3/24/2019


Incremental Search Hazards
• If the spacing between the points of an incremental search are too far
apart, brackets may be missed due to capturing an even number of
roots within two points.
• Incremental searches cannot find brackets containing even-multiplicity
roots regardless of spacing.

39 STR N 215 – Computetional Enginnering 3/24/2019


Bisection
• The bisection method is a variation of the incremental search method in
which the interval is always divided in half.

• If a function changes sign over an interval, the function value at the


midpoint is evaluated.

• The location of the root is then determined as lying within the


subinterval where the sign change occurs.

• The absolute error is reduced by a factor of 2 for each iteration.


40 STR N 215 – Computetional Enginnering 3/24/2019
Bisection
200

150
Summation of “F” (kN)

100

50

0
50 70 90
-50

-100
Location of N.A. (mm)
41 STR N 215 – Computetional Enginnering 3/24/2019
Bisection

42 STR N 215 – Computetional Enginnering 3/24/2019


Bisection flowchart
a= lower value
START c=(a+b)/2
b= greater value

YES
NO
Check
b=c
f(a) x f(c)>0
END

YES
NO
Check a=c
ROOT=c
Abs(a-b)>tolerance

43 STR N 215 – Computetional Enginnering 3/24/2019


44 STR N 215 – Computetional Enginnering 3/24/2019
STR N 215 – Computational
Engineering
Lecture No. 3
Numerical Integration

45 STR N 215 – Computetional Enginnering 3/24/2019


Relation between Load – Shear and Moment
L
Shear    Load dx
0

L
Moment   Shear dx
0

46 STR N 215 – Computetional Enginnering 3/24/2019


Relation between Load – Shear and Moment
• Example: a simply supported beam with
a linear load as shown. Calculate shear,
and moment at any section
x x
x
Shear@ x    Load dx    w0 dx
0 2 0
L
x
 Shear@ x   w0  C1
2L
x x
 x2 
Moment@ x   shear dx     w0  C1 
0 3 0
2L 
x
 Moment@ x   w0  C1 x  C2
6L
47 STR N 215 – Computetional Enginnering 3/24/2019
Energy dissipation
• In nonlinear analysis, dissipated energy
can be determined using numerical
integration.

 f x dx
b
I
a

• is the total value, or summation, of f(x)


dx over the range from a to b:

48 STR N 215 – Computetional Enginnering 3/24/2019


The trapezoidal rule
• The trapezoidal rule uses a straight-line
approximation for the function:
b
I   f n  x  dx
a

f a   f b 
I  b  a 
2

49 STR N 215 – Computetional Enginnering 3/24/2019


Error of the trapezoidal rule
• An estimate for the local truncation error of a
single application of the trapezoidal rule is:
1
f  b  a 
 3
Et  
12
where is somewhere between a and b.
• This formula indicates that the error is dependent
upon the curvature of the actual function as well
as the distance between the points.
• Error can thus be reduced by breaking the curve
into parts.

50 STR N 215 – Computetional Enginnering 3/24/2019


Example
f x   0.2  25 x  200 x 2  675 x 3  900 x 4  400 x 5

• From a=0 to b=0.8. Note that the exact value of


the integral can be determined analytically to be
1.640533
f 0   0.2 f 0.8  0.232
0.2  0.232
I  0.8  0   0.1728
2
Et  1.640533  0.1728  1.467733 (89.5%)
51 STR N 215 – Computetional Enginnering 3/24/2019
Composite Trapezoidal Rule
• Assuming n+1 data points are evenly spaced,
there will be n intervals over which to integrate.
• The total integral can be calculated by
integrating each subinterval and then adding
them together:

I   f n  x  dx   f n x  dx   f n  x  dx     f n  x  dx
xn x1 x2 xn

x0 x0 x1 xn1

f  x0   f  x1  f x1   f x2  f xn 1   f xn 


I   x1  x0   x2  x1     xn  xn 1 
2 2 2
h n 1

I   f x0   2 f xi   f  xn 
2 i 1 
52 STR N 215 – Computetional Enginnering 3/24/2019
Composite Trapezoidal Rule

53 STR N 215 – Computetional Enginnering 3/24/2019


Simpson’s Rules
• One drawback of the trapezoidal rule is that the error is related to the
second derivative of the function.
• More complicated approximation formulas can improve the accuracy for
curves - these include using (a) 2nd and (b) 3rd order polynomials.
• The formulas that result from taking the integrals under these polynomials
are called Simpson’s rules.

54 STR N 215 – Computetional Enginnering 3/24/2019


Simpson’s 1/3 Rule
• Simpson’s 1/3 rule corresponds to using second-
order polynomials. Using the Lagrange form
for a quadratic fit of three points:

fn x  
x  x1  x  x2 
f x0  
x  x0  x  x2 
f x1  
x  x0  x  x1 
f x2 
x0  x1  x0  x2  x1  x0  x1  x2  x2  x0  x2  x1 
Integration over the three points simplifies to:


x2
I fn x dx
x0

h
I   f x0   4 f x1   f x2 
3
55 STR N 215 – Computetional Enginnering 3/24/2019
Error of Simpson’s 1/3 Rule
• An estimate for the local truncation error of a single application of Simpson’s
1/3 rule is:
1
Et   f4 
 b  a 
5

2880
where is somewhere between a and b.
• This formula indicates that the error is dependent upon the fourth-derivative of
the actual function as well as the distance between the points.
• Note that the error is dependent on the fifth power of the step size (rather than
the third for the trapezoidal rule).
• Error can thus be reduced by breaking the curve into parts.

56 STR N 215 – Computetional Enginnering 3/24/2019


Example
f x   0.2  25 x  200 x 2  675 x 3  900 x 4  400 x 5

• From a=0 to b=0.8. Note that the exact value of


the integral can be determined analytically to be
1.640533
n  2h  0.4 
f 0   0.2 f 0.4   2.456 f 0.8  0.232
0 .4
I 0.2  4  2.456  0.232  1.367467
3
Et  1.640533  1.367467  0.2730667 (16.6%)
57 STR N 215 – Computetional Enginnering 3/24/2019
Composite Simpson’s 1/3 Rule
I   f n x  dx   f n x  dx   f n  x  dx     f n  x  dx
xn x2 x4 xn

x0 x0 x2 x n 2

h
I  f x0   4 f x1   f x2   h  f x2   4 f x3   f x4     h  f xn2   4 f xn1   f xn 
3 3 3
 n 1 n2

h
I   f  x0   4  f xi   2  f  xi   f  xn 
3 i 1 j 2

 i , odd j , even 

58 STR N 215 – Computetional Enginnering 3/24/2019


Composite Simpson’s 1/3 Rule

59 STR N 215 – Computetional Enginnering 3/24/2019


Simpson’s 3/8 Rule
• Simpson’s 3/8 rule corresponds to using third-
order polynomials to fit four points. Integration
over the four points simplifies to:

x3
I fn x dx
x0

3h
I
8
 f x0   3 f x1   3 f x2   f x3 
• Simpson’s 3/8 rule is generally used in concert
with Simpson’s 1/3 rule when the number of
segments is odd

60 STR N 215 – Computetional Enginnering 3/24/2019


Simpson’s 3/8 Rule

61 STR N 215 – Computetional Enginnering 3/24/2019


Simpson’s 3/8 Rule

62 STR N 215 – Computetional Enginnering 3/24/2019


Integration with Unequal Segments
• Previous formulas were simplified based on equal spaced data points -
though this is not always the case.
• The trapezoidal rule may be used with data containing unequal segments:

I   f n  x  dx   f n  x  dx   f n  x  dx     f n x  dx
xn x1 x2 xn

x0 x0 x1 xn1

f  x0   f  x1  f x1   f  x2  f xn 1   f  xn 
I   x1  x0   x2  x1     xn  xn 1 
2 2 2

63 STR N 215 – Computetional Enginnering 3/24/2019


Integration with Unequal Segments

64 STR N 215 – Computetional Enginnering 3/24/2019


MATLAB Functions
• MATLAB has built-in functions to evaluate integrals based on the
trapezoidal rule
• z = trapz(y)
z = trapz(x, y)
produces the integral of y with respect to x. If x is omitted, the program
assumes h=1.
• z = cumtrapz(y)
z = cumtrapz(x, y)
produces the cumulative integral of y with respect to x. If x is omitted, the
program assumes h=1.
• z = quad(F,a,b)
Numerically evaluate the integral of F from A to B
65 STR N 215 – Computetional Enginnering 3/24/2019
66 STR N 215 – Computetional Enginnering 3/24/2019
STR 681 – Advanced
Numerical Analysis
Lecture No. 4
Gauss Elimination

67 STR N 215 – Computetional Enginnering 3/24/2019


Methods of Structural Analysis
• Forced Analysis method
• Consistent Deformation

  R 
ij 99 i 91  Ci 91

• Displacement Analysis Method


• Stiffness Analysis Method
K  U 
ij 66 i 66  Ci 66

K  U 
ij 22 i 22  Ci 22
68 STR N 215 – Computetional Enginnering 3/24/2019
Stress of a Uniform Rod
• Recall from elementary mechanics of solids that a uniform rod of
length L, cross sectional area A, and elastic modulus E can be modeled
as a linear spring of stiffness keq

69 STR N 215 – Computetional Enginnering 3/24/2019


Nodal Displacements, Forces
• Consider a linear spring of stiffness k. Let the displacements of its two
ends, called nodes, be denoted by ui and uj , known as nodal
displacements. Let the forces acting at its two ends, called nodal
forces, be denoted by fi and fj

70 STR N 215 – Computetional Enginnering 3/24/2019


Force Displacement Relations
• The relationships between the nodal forces and displacements (as shown
below) are given by:
f i  k ui  u j 

f j  k u j  ui 
• These relations can be written in matrix form as:
 fi   k  k   ui 
    
 f j   k k  u j 

71 STR N 215 – Computetional Enginnering 3/24/2019


Multiple Elements

72 STR N 215 – Computetional Enginnering 3/24/2019


Continuity Relations
• When two elements are joined together the joined nodes become one and
must have the same displacement

u2  u (j1)  ui( 2)

where the subscript denotes the global node number, the superscript
denotes the global element number, and I and j denote local node numbers

73 STR N 215 – Computetional Enginnering 3/24/2019


Force Balance Relations
• The external nodal forces acting at each node must equal the sum of the
element nodal forces at all nodes
F1  f i (1)
F2  f j(1)  f i ( 2 )
F3  f j( 2 )

where F1 , F2 , F3 are external nodal forces numbered globally

74 STR N 215 – Computetional Enginnering 3/24/2019


Assembly of Equations
• When these continuity and force balance relations are imposed the
resulting global equilibrium equations are

 F1   k1  k1 0   u1 
    
 F2    k1 k1  k 2  k 2  u2 
F   0  k2 k 2  u3 
 3 
75 STR N 215 – Computetional Enginnering 3/24/2019
76 STR N 215 – Computetional Enginnering 3/24/2019
Graphical Method
• For small sets of simultaneous equations,
graphing them and determining the location of
the intercept provides a solution.
• Graphing the equations can also show systems
where:
a) No solution exists
b) Infinite solutions
exist
a) System is
ill-conditioned

77 STR N 215 – Computetional Enginnering 3/24/2019


Determinants
• The determinant D=|A| of a matrix is formed from the coefficients of [A].
• Determinants for small matrices are:
11 a11  a11
a11 a12
22  a11a22  a12 a21
a21 a22
a11 a12 a13
a22 a23 a21 a23 a21 a22
3 3 a21 a22 a23  a11  a12  a13
a32 a33 a31 a33 a31 a32
a31 a32 a33

• Determinants for matrices larger than 3 x 3 can be very complicated.


78 STR N 215 – Computetional Enginnering 3/24/2019
Cramer’s Rule
• Cramer’s Rule states that each unknown in a system of linear algebraic
equations may be expressed as a fraction of two determinants with
denominator D and with the numerator obtained from D by replacing
the column of coefficients of the unknown in question by the constants
b1, b2, …, bn.

79 STR N 215 – Computetional Enginnering 3/24/2019


Cramer’s Rule Example
• Find x2 in the following system of equations: 0.3x1  0.52x 2  x 3  0.01
0.5x1  x 2  1.9x 3  0.67
0.1x1  0.3x 2  0.5x 3  0.44

• Find the determinant D


0.3 0.52 1
1 1.9 0.5 1.9 0.5 1
D  0.5 1 1.9  0.3  0.52 1  0.0022
0.3 0.5 0.1 0.5 0.1 0.4
0.1 0.3 0.5
• Find determinant D2 by replacing D’s second column with b
0.3 0.01 1
0.67 1.9 0.5 1.9 0.5 0.67
D2  0.5 0.67 1.9  0.3  0.01 1  0.0649
0.44 0.5 0.1 0.5 0.1 0.44
0.1 0.44 0.5
• Divide
D2 0.0649
x2    29.5
80 D 0.0022 STR N 215 – Computetional Enginnering 3/24/2019
Naïve Gauss Elimination
• For larger systems, Cramer’s Rule can become unwieldy.

• Instead, a sequential process of removing unknowns from equations


using forward elimination followed by back substitution may be used -
this is Gauss elimination.

• “Naïve” Gauss elimination simply means the process does not check for
potential problems resulting from division by zero.

81 STR N 215 – Computetional Enginnering 3/24/2019


Naïve Gauss Elimination (cont)
• Forward elimination
• Starting with the first row, add or subtract multiples of that
row to eliminate the first coefficient from the second row
and beyond.
• Continue this process with the second row to remove the
second coefficient from the third row and beyond.
• Stop when an upper triangular matrix remains.
• Back substitution
• Starting with the last row, solve for the unknown, then
substitute that value into the next highest row.
• Because of the upper-triangular nature of the matrix, each
row will contain only one more unknown.

82 STR N 215 – Computetional Enginnering 3/24/2019


83 STR N 215 – Computetional Enginnering 3/24/2019
B. Sc. Program - Credit Hours System
STRN215 – Engineering Computations

Lecture No. 5
LU Factorization &
Matrix Inverse and Condition

84 STR N 215 – Computetional Enginnering 3/24/2019


LU Factorization
• Recall that the forward-elimination step of Gauss elimination
comprises the bulk of the computational effort.
• LU factorization methods separate the time-consuming elimination of
the matrix [A] from the manipulations of the right-hand-side [b].
• Once [A] has been factored (or decomposed), multiple right-hand-side
vectors can be evaluated in an efficient manner.

85 STR N 215 – Computetional Enginnering 3/24/2019


LU Factorization
• LU factorization involves two
steps:
• Factorization to decompose the
[A] matrix into a product of a
lower triangular matrix [L] and
an upper triangular matrix [U].
[L] has 1 for each entry on the
diagonal.
• Substitution to solve for {x}
• Gauss elimination can be
implemented using LU
factorization

86 STR N 215 – Computetional Enginnering 3/24/2019


Gauss Elimination as
LU Factorization
• [A]{x}={b} can be rewritten as [L][U]{x}={b} using LU factorization.

• The LU factorization algorithm requires the same total flops as for


Gauss elimination.

• The main advantage is once [A] is decomposed, the same [L] and [U]
can be used for multiple {b} vectors.

• MATLAB’s lu function can be used to generate the [L] and [U]


matrices:
[L, U] = lu(A)
87 STR N 215 – Computetional Enginnering 3/24/2019
Gauss Elimination as
LU Factorization (cont)
• To solve [A]{x}={b}, first decompose [A] to get [L][U]{x}={b}
• Set up and solve [L]{d}={b}, where {d} can be found using forward
substitution.
• Set up and solve [U]{x}={d}, where {x} can be found using backward
substitution.
• In MATLAB:
[L, U] = lu(A)
d = L\b
x = U\d

88 STR N 215 – Computetional Enginnering 3/24/2019


Cholesky Factorization
• Symmetric systems occur commonly in both mathematical and
engineering/science problem contexts, and there are special solution
techniques available for such systems.
• The Cholesky factorization is one of the most popular of these
techniques, and is based on the fact that a symmetric matrix can be
decomposed as [A]= [U]T[U], where T stands for transpose.
• The rest of the process is similar to LU decomposition and Gauss
elimination, except only one matrix, [U], needs to be stored.

89 STR N 215 – Computetional Enginnering 3/24/2019


MATLAB
• MATLAB can perform a Cholesky factorization with the built-in
chol command:
U = chol(A)
• MATLAB’s left division operator \ examines the system to see which
method will most efficiently solve the problem. This includes trying
banded solvers, back and forward substitutions, Cholesky factorization
for symmetric systems.

90 STR N 215 – Computetional Enginnering 3/24/2019


Matrix Inverse
• Recall that if a matrix [A] is square, there is another matrix [A]-1,
called the inverse of [A], for which [A][A]-1=[A]-1[A]=[I]
• The inverse can be computed in a column by column fashion by
generating solutions with unit vectors as the right-hand-side constants:


1
 
0
 
0

Ax1  0 Ax 2   1 Ax 3  0

0
 
0
 
1

A  x1 x3 
1
x2

91 STR N 215 – Computetional Enginnering 3/24/2019


Matrix Inverse (cont’)
• Recall that LU factorization can be used to efficiently evaluate a
system for multiple right-hand-side vectors - thus, it is ideal for
evaluating the multiple unit vectors needed to compute the inverse.

92 STR N 215 – Computetional Enginnering 3/24/2019


Vector and Matrix Norms
• A norm is a real-valued function that provides a measure of the size or
“length” of multi-component mathematical entities such as vectors and
matrices.
• Vector norms and matrix norms may be computed differently.

93 STR N 215 – Computetional Enginnering 3/24/2019


Vector Norms
• For a vector {X} of size n, the p-norm is:
1/ p
 n 
  x i 
p
X p
i1 
• Important examples of vector p-norms include:
n
p  1 : sum of the absolute values X 1   xi
i1
n
p  2 : Euclidian norm (length) X2 Xe x 2
i
i1
p   : maximum  magnitude X 
 max xi
1in

94 STR N 215 – Computetional Enginnering 3/24/2019


Matrix Norms
• Common matrix norms for a matrix [A] include:
n
column - sum norm A 1  max  aij
1 jn
i1
n n
Frobenius norm A f   a 2
ij
i1 j1
n
row - sum norm A   max  aij
1in
j1

A 2   max 
1/2
spectral norm (2 norm)
• Note - max is the largest eigenvalue of [A]T[A].

95 STR N 215 – Computetional Enginnering 3/24/2019


MATLAB Commands
• MATLAB has built-in functions to compute both norms and condition
numbers:
• norm(X,p)
• Compute the p norm of vector X, where p can be any number, inf, or ‘fro’ (for the
Euclidean norm)
• norm(A,p)
• Compute a norm of matrix A, where p can be 1, 2, inf, or ‘fro’ (for the Frobenius norm)
• cond(X,p) or cond(A,p)
• Calculate the condition number of vector X or matrix A using the norm specified by p.

96 STR N 215 – Computetional Enginnering 3/24/2019


97 STR N 215 – Computetional Enginnering 3/24/2019
STR 681 – Advanced
Numerical Analysis
Lecture No. 6
Initial-Value Problems

98 STR N 215 – Computetional Enginnering 3/24/2019


Chapter Objectives
• Understanding the meaning of local and global truncation errors and their relationship to
step size for one-step methods for solving ODEs.
• Knowing how to implement the following Runge-Kutta (RK) methods for a single ODE:
• Euler
• Heun
• Midpoint
• Fourth-Order RK
• Knowing how to iterate the corrector of Heun’s method.
• Knowing how to implement the following Runge-Kutta methods for systems of ODEs:
• Euler
• Fourth-order RK

99 STR N 215 – Computetional Enginnering 3/24/2019


Ordinary Differential Equations
• Methods described here are for solving differential
equations of the form:
dy
 f t, y
dt
dv c v- dependent variable
g v
dt m t- independent variable
• The methods in this chapter are all one-step methods and
have the general format:
yi1  yi  h
where  is called an increment function, and is used to
extrapolate from an old value yi to a new value yi+1.
100 STR N 215 – Computetional Enginnering 3/24/2019
Euler’s Method
• The first derivative provides a
direct estimate of the slope at
ti:
dy
 f t i , yi 
dt ti
• and the Euler method uses that
estimate as the increment
function:
  f t i , yi 
yi1  yi  f t i , yi h
Taylor series expansion

101 STR N 215 – Computetional Enginnering 3/24/2019


Error Analysis for Euler’s Method
• The numerical solution of ODEs involves two types of error:
• Truncation errors, caused by the nature of the techniques employed
• Roundoff errors, caused by the limited numbers of significant digits that can
be retained
• The total, or global truncation error can be further split into:
• local truncation error that results from an application method in question over
a single step, and
• propagated truncation error that results from the approximations produced
during previous steps.

102 STR N 215 – Computetional Enginnering 3/24/2019


Error Analysis for Euler’s Method
• The local truncation error for Euler’s method is O(h2) and proportional
to the derivative of f (t,y) while the global truncation error is O (h).
• This means:
• The global error can be reduced by decreasing the step size, and
• Euler’s method will provide error-free predictions if the underlying function is
linear.
• Euler’s method is conditionally stable, depending on the size of h.

103 STR N 215 – Computetional Enginnering 3/24/2019


104 STR N 215 – Computetional Enginnering 3/24/2019
105 STR N 215 – Computetional Enginnering 3/24/2019
Improvements of Euler’s method
• A fundamental source of error in Euler’s method is that the derivative
at the beginning of the interval is assumed to apply across the entire
interval.
• Two simple modifications are available to circumvent this
shortcoming:
• Heun’s Method
• The Midpoint (or Improved Polygon) Method

106 STR N 215 – Computetional Enginnering 3/24/2019


Heun’s Method
• One method to improve Euler’s method is to determine derivatives
at the beginning and predicted ending of the interval and average
them:
• This process relies on making a prediction of the new value of y,
then correcting it based on the slope calculated at that new value.
• This predictor-corrector approach can be iterated to convergence:

Predictor : yi01  yi  f ( xi , yi )h
f ( xi , yi )  f ( xi 1 , yi01 )
Corrector : yi 1  yi  h
2

107 STR N 215 – Computetional Enginnering 3/24/2019


108 STR N 215 – Computetional Enginnering 3/24/2019
yxold , yold   yxnew , ynew 
ynew  yold  h
2
• @ t=0 & y=2
y0  4e 0.8t  0.5 y  4e 0  0.5  2  3
y1  y0  y x0 , y0 h  2  3 1  5

• First Trial (t=1 & y=5)


y1  4e 0.8t  0.5 y  4e 0.81  0.5  5  6.402164
y xold , yold   yxnew , ynew  3  6.402164
ynew  yold  h  2 1  6.701082
2 2
error  6.701082  5 6.701082  100%  25.39%

• Second Trial (t=1 & y=6.701082)


y1  4e 0.8t  0.5 y  4e 0.81  0.5  6.701082  5.551623
y xold , yold   y xnew , ynew  3  5.551623
ynew  yold  h  2 1  6.275811
2 2
109 error  6.275811  6.701082 STR N6215
.275811  100Enginnering
– Computetional %  6.776% 3/24/2019
110 STR N 215 – Computetional Enginnering 3/24/2019
Midpoint Method
• Another improvement to Euler’s method is similar to
Heun’s method, but predicts the slope at the midpoint of
an interval rather than at the end:

yi 1  yi  f ( xi 1/ 2 , yi 1/ 2 )h

This method has a local truncation error of O(h3) and


global error of O(h2)

111 STR N 215 – Computetional Enginnering 3/24/2019


112 STR N 215 – Computetional Enginnering 3/24/2019
Runge-Kutta Methods
• Runge-Kutta (RK) methods achieve the accuracy of a Taylor series
approach without requiring the calculation of higher derivatives.
• For RK methods, the increment function  can be generally written
as:
  a1k1  a2 k2  an kn

where the a’s are constants and the k’s are
k1  f ti , yi 
k 2  f ti  p1h, yi  q11k1h 
k3  f ti  p2 h, yi  q21k1h  q22 k 2 h 

k n  f ti  pn 1h, yi  qn 1,1k1h  qn 1, 2 k 2 h    qn 1,n 1k n 1h 
• where the p’s and q’s are constants.
113 STR N 215 – Computetional Enginnering 3/24/2019
Second-Order Runge-Kutta Method

yi 1  yi  (a1k1  a2 k 2 )h a1  a2  1 A value is
assumed
1
k1  f ( x i , yi ) a 2 p1  for a2 to
2 solve for
k 2  f ( xi  p1h, yi  q11k1h) 1 the other
a2 q11 
2 three.

114 3/24/2019 STR N 215 – Computetional Enginnering


Three equations to evaluate four unknowns •
constants are derived.
Three of the most commonly used methods are: •
Huen Method with a Single Corrector (a2=1/2) •
The Midpoint Method (a2=1) •
Raltson’s Method (a2=2/3): •

115 3/24/2019 STR N 215 – Computetional Enginnering


Figure 25.14

116 3/24/2019 STR N 215 – Computetional Enginnering


Classical Fourth-Order Runge-Kutta Method
• The most popular RK methods are fourth-order, and the most
commonly used form is: 1
yi1  yi  k1  2k2  2k3  k4 h
6
where:
k1  f ti , yi 
 1 1 
k2  f t i  h, yi  k1h 
 2 2 
 1 1 
k3  f t i  h, yi  k2 h 
 2 2 
k4  f ti  h, yi  k3h
117 STR N 215 – Computetional Enginnering 3/24/2019
118 STR N 215 – Computetional Enginnering 3/24/2019
MATLAB Functions
• MATLAB’s ode23 function uses second- and third-order RK
functions to solve the ODE and adjust step sizes.
• MATLAB’s ode45 function uses fourth- and fifth-order RK functions
to solve the ODE and adjust step sizes. This is recommended as the
first function to use to solve a problem.
• MATLAB’s ode113 function is a multistep solver useful for
computationally intensive ODE functions.

119 STR N 215 – Computetional Enginnering 3/24/2019


Using ode Functions
• The functions are generally called in the same way; ode45 is used as
an example:
[t, y] = ode45(odefun, tspan, y0)
• y: solution array, where each column represents one of the variables and each
row corresponds to a time in the t vector
• odefun: function returning a column vector of the right-hand-sides of the
ODEs
• tspan: time over which to solve the system
• If tspan has two entries, the results are reported for those times as well as several
intermediate times based on the steps taken by the algorithm
• If tspan has more than two entries, the results are reported only for those specific times
• y0: vector of initial values

120 STR N 215 – Computetional Enginnering 3/24/2019


ODE Solver Options
• Options to ODE solvers may be passed as an optional fourth argument,
and are generally created using the odeset function:
options=odeset(‘par1’, ‘val1’, ‘par2’, ‘val2’,…)
• Commonly used parameters are:
• ‘RelTol’: adjusts relative tolerance
• ‘AbsTol’: adjusts absolute tolerance
• ‘InitialStep’: sets initial step size
• ‘MaxStep’: sets maximum step size (default: one tenth of tspan interval)

121 STR N 215 – Computetional Enginnering 3/24/2019


122 STR N 215 – Computetional Enginnering 3/24/2019
STR 681 – Advanced
Numerical Analysis
Lecture No. 7
Iterative Methods and Eigenvalue Problems

123 STR N 215 – Computetional Enginnering 3/24/2019


Gauss-Seidel Method
• The Gauss-Seidel method is the most commonly used iterative method for solving
linear algebraic equations [A]{x}={b}.
• The method solves each equation in a system for a particular variable, and then
uses that value in later equations to solve later variables. For a 3x3 system with
nonzero elements along the diagonal, for example, the j th iteration values are
found from the j-1th iteration using:
b1  a12 x2j1  a13 x3j1
x 
1
j

a11
b2  a21 x1j  a23 x3j1
x 
j
2
a22
b3  a31 x1j  a32 x2j
x 
j
3
a33
124 STR N 215 – Computetional Enginnering 3/24/2019
125 STR N 215 – Computetional Enginnering 3/24/2019
126 STR N 215 – Computetional Enginnering 3/24/2019
Jacobi Iteration

127 STR N 215 – Computetional Enginnering 3/24/2019


Gauss-Seidel Iteration Jacobi Iteration
Convergence
• The convergence of an iterative method can be calculated by
determining the relative percent change of each element in {x}. For
example, for the i th element in the j th iteration,

xij  xij1
e a,i  j
100%
xi
• The method is ended when all elements have converged to a set
tolerance.

128 STR N 215 – Computetional Enginnering 3/24/2019


Diagonal Dominance
• The Gauss-Seidel method may diverge, but if the system is diagonally
dominant, it will definitely converge.
• Diagonal dominance means:
n
aii   aij
j1
ji

129 STR N 215 – Computetional Enginnering 3/24/2019


130 STR N 215 – Computetional Enginnering 3/24/2019
Eigenvalue and
Eigenvector Problems

131 STR N 215 – Computetional Enginnering 3/24/2019


Mathematics
Up until now, heterogeneous systems:
[A] {x} = {b}
What about homogeneous systems:

[A] {x} = 0
Trivial solution:
{x} = 0
Is there another way of formulating the system
132 so that the solution would be meaningful???
STR N 215 – Computetional Enginnering 3/24/2019
Mathematics
What about a homogeneous system like:
(a11 – l) x1 + a12 x2 + a13 x3 = 0
a21 x1 + (a22 – l) x2 + a23 x3 = 0
a31 x1 + a32 x2 + (a33 – l) x3 = 0
or in matrix form
[[A] – lI ]{x} = 0
For this case, there could be a value of l that
makes the equations equal zero for non-zero x. This
133
is called an eigenvalue.
STR N 215 – Computetional Enginnering 3/24/2019
Physical Background:
Oscillations or Vibrations of Mass-
Spring Systems

134 STR N 215 – Computetional Enginnering 3/24/2019


Model With Force Balances
(AKA: F = ma)
d 2x 1
m1 = – k x1 + k(x2 – x1)
dt 2

d 2x 2
m2 = – k(x2 – x1) – kx2
dt 2

Collect terms:
d 2x1
m1 – k (– 2x1 + x2) = 0
dt 2

d 2x 2
m2 – k (x1 – 2x2) = 0
135
dt 2 215 – Computetional Enginnering
STR N 3/24/2019
Assume a Sinusoidal Solution

2p
xi = Xi sin (w t) where w=
Tp

Differentiate twice:

xi” = – Xi w 2 sin (wt)

Substitute back into system and collect


136
terms
STR N 215 – Computetional Enginnering 3/24/2019
2k k
 w2 X1 – X2 0
m1 m1
k 2k
X1 +  w2 X2 0
m2 m2
Given: m1 = m2 = 40 kg; k = 200 N/m
(10 – w2) X1 – 5 X2 = 0
– 5 X1 + (10 – w2) X2 = 0
This is now a homogeneous system where the
eigenvalue represents the square of the fundamental
137 STR Nfrequency.
215 – Computetional Enginnering 3/24/2019
Solution: The Polynomial Method
10 – w 2  5 X1 0
=
– 5 10 – w 2 X2 0
Evaluate the determinant to yield a polynomial
10 – w 2  5
= ( w 2)2  20w 2 75
– 5 10 – w 2
The two roots of this "characteristic polynomial" are
the system's eigenvalues:
15 or w 3.873
138
w2 = 5 STR N 215 – Computetional Enginnering 2.36 3/24/2019
INTERPRETATION
Tp = 2p/2.236 = 2.81 s Tp = 2p/3.373 = 1.62 s

(10 – w2) X1 – 5 X2 = 0
– 5 X1 + (10 – w2) X2 = 0
(10 – 5) X1 – 5 X2 = 0 (10 – 15) X1 – 5 X2 = 0
– 5 X1 + (10 – 5) X2 = 0 – 5 X1 + (10 – 15) X2 = 0
5 X1 – 5 X2 = 0 – 5 X1 – 5 X 2 = 0
– 5 X 1 + 5 X2 = 0 – 5 X1 – 5 X 2 = 0
X1 = X2 X1 = –X2

–0.7071 –0.7071
V= V=
139 –0.7071 STR N 215 – Computetional Enginnering 0.7071 3/24/2019
Principle Modes of Vibration

Tp = 1.62

Tp = 2.81

140 STR N 215 – Computetional Enginnering 3/24/2019


Eigenvalues & Eigenvectors with
MATLAB
>> A = [10 -5;-5 10]
A=
10 -5
-5 10
>> [v,lambda] = eig(A)
v=
-0.7071 -0.7071
-0.7071 0.7071
lambda =
5 0
0 15
141 STR N 215 – Computetional Enginnering 3/24/2019
The Power Method
Iterative method to compute the largest eigenvalue and its associated eigenvector.

[[A]  l[I]]]{x} = 0
[A]{x} = l{x}
Simple Algorithm:

function [eval, evect] = powereig(A,es,maxit)


n=length(A);
evect=ones(n,1);eval=1;iter=0;ea=100; %initialize
while(1)
evalold=eval; %save old eigenvalue value
evect=A*evect; %determine eigenvector as [A]*{x)
eval=max(abs(evect)); %determine new eigenvalue
evect=evect./eval; %normalize eigenvector to eigenvalue
iter=iter+1;
if eval~=0, ea = abs((eval-evalold)/eval)*100; end
if ea<=es | iter >= maxit,break,end
142 STR N 215 – Computetional Enginnering end 3/24/2019
Example: The Power Method
First iteration:
40 20 0 1 20 1
20 40 20 1 = 0 = 20 0
0 20 40 1 20 1

Second iteration:
40 20 0 1 40 1
20 40 20 0 = 20 = 40 1
0 20 40 1 40 1

40  20
|ea| = 40  100% = 50%
143 STR N 215 – Computetional Enginnering 3/24/2019
Example: The Power Method
Third iteration:
40 20 0 1 60 0.75
20 40 20 1 = 80 = 80 1
0 20 40 1 60 0.75

80  40
|ea| = 80  100% = 150%

Fourth iteration:
40 20 0 0.75 50 0.71429
20 40 20 1 = 70 = 70 1
0 20 40 0.75 50 0.71429

70  80)
| e a| = 70  100% = 214%
144 STR N 215 – Computetional Enginnering 3/24/2019
Example: The Power Method
Fifth iteration:

40 20 0 0.71429 48.51714 0.71429


20 40 20 1 = 68.51714 = 68.51714 1
0 20 40 0.71429 48.51714 0.71429

| ea | = 68.51714  70
70  100% = 2.08%

The process can be continued to determine the largest


eigenvalue (= 68.284) with the associated eigenvector
[-0.7071 1 -0.7071]

Note that the smallest eigenvalue and its associated


eigenvector can be determined by applying the
145 power method to theEnginnering
STR N 215 – Computetional inverse of A 3/24/2019
Eigenvalues with Matlab
• Matlab:

146 STR N 215 – Computetional Enginnering 3/24/2019


Dynamics of Three Story Building

147 STR N 215 – Computetional Enginnering 3/24/2019


Solution

148 STR N 215 – Computetional Enginnering 3/24/2019


Principle Modes of Vibration

149 STR N 215 – Computetional Enginnering 3/24/2019


STR 215 – Computational
Engineering
Lecture No. 8
Regression

150 STR 215- Computational Engineering 3/24/2019


Least Squares Regression

Linear Regression
• Fitting a straight line to a set of paired observations: (x1, y1), (x2,
y2),…,(xn, yn).
y=a0+a1x+e
a1- slope
a0- intercept
e- error, or residual, between the model and the observations

151 STR 215- Computational Engineering 3/24/2019


Criteria for a “Best” Fit
• Minimize the sum of the
residual errors for all
available data:
n n

e  (y
i 1
i
i 1
i  ao  a1 xi )
n = total number of points
• However, this is an
inadequate criterion, so is the
sum of the absolute values

n n

e  y
i 1
i
i 1
i  a0  a1 xi
152 STR 215- Computational Engineering 3/24/2019
• Best strategy is to minimize the sum of the squares of
the residuals between the measured y and the y
calculated with the linear model:
n n n
S r   e   ( yi , measured  yi , model)   ( yi  a0  a1 xi ) 2
2
i
2

i 1 i 1 i 1

• Yields a unique line for a given set of data.

153 3/24/2019 STR 215- Computational Engineering


List-Squares Fit of a Straight Line
S r
 2 ( yi  ao  a1 xi )  0
ao
S r
 2 ( yi  ao  a1 xi ) xi   0
a1
0   yi   a 0   a1 xi
0   yi xi   a 0 xi   a1 xi2

a 0  na0
na0   xi a1   yi
Normal equations, can be
solved simultaneously

n xi yi   xi  yi
a1 
n x   xi 
2 2
i Mean values
154 a0  y  a1 x STR 215- Computational Engineering 3/24/2019
155 STR 215- Computational Engineering 3/24/2019
“Goodness” of fit
Total sum of the squares around the mean for the
dependent variable, y, is St
• Sum of the squares of residuals around the regression
line is Sr
• St-Sr quantifies the improvement or error reduction
due to describing data in terms of a straight line rather
than as an average value.

St  S r
r 
2

St
r2-coefficient of determination

156 3/24/2019 STR 215- Computational Engineering


• For a perfect fit
Sr=0 and r=r2=1, signifying that the line explains 100
percent of the variability of the data.
• For r=r2=0, Sr=St, the fit represents no improvement.

157 STR 215- Computational Engineering 3/24/2019


158 STR 215- Computational Engineering 3/24/2019
Linearization of Nonlinear Relationships

159 STR 215- Computational Engineering 3/24/2019

You might also like