ENGINEERING COMPUTING ENG1602 - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

ENGINEERING COMPUTING ENG1602

Description:

Often the Engineer has to fit a (Mathematical) model to some ... Least Squares Fit - Conclusions. These relationships involve all the data points specified ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 24
Provided by: dsu3
Category:

less

Transcript and Presenter's Notes

Title: ENGINEERING COMPUTING ENG1602


1
ENGINEERING COMPUTING ENG1602
BACHELOR of ENGINEERING
Week 3 Lecture 1 Microsoft EXCEL CASE
STUDY REGRESSION FOURIER SERIES
2
CASE STUDY LEAST SQUARES
  • Often the Engineer has to fit a (Mathematical)
    model to some experimental data - the data will
    not generally fit perfectly as there may be
    errors ( in measurement, or un-modelled small
    effects, etc.)
  • Take the case of a simple linear model - one has
    to find a line that best fits What does that
    mean?

3
CURVE FITTING
  • If f(x) is an unknown function defined by pairs
    of x values and corresponding y values, so that y
    f(x) over the given range.
  • It is desired to select another known function
    g(x, C1, C2,...... Cn)
    and then determine the constants
    C1, C2, ...... Cn such that g(x) fits
    the given values of f(x) with minimum Error.

4
Best Fit - Minimum Error - 1.
  • Simple Strategy - If there are m pairs of data
    and n unknown constants in the chosen function
    g(x), it being assumed that n lt m
  • Then Select n pairs of values from the m
    available.
  • Substitute Solve for the values of the n
    constants from the n resulting simultaneous
    equations.

5
Best Fit - Minimum Error - 2.
  • Then the function g(x) will fit the data exactly
    at the n chosen points.
  • but there may be serious errors at the (m-n)
    unused points.
  • Note that the chosen function g(x) must be such
    that n lt m, otherwise there are not enough
    equations to solve for the unknown constants.
  • However if m gt n then which n points should be
    selected ?

6
Example Fit y g(x) A Bx ( n 2 ) to 3
Data Points ( m 3 )
Point 2
y
Error
Point 3 Exact
B
Simple Solution using Data Points 1 3 to
solve for A B
1
Point 1 Exact
A
x
7
Analysis of the Solution
  • Whilst the function fits exactly at two points,
    there are serious errors elsewhere
  • Also totally different results would result
    depending which two of the three available points
    were chosen to determine the constants
  • It is possible to do better !

8
Intuitive Line of Best Fit
Point 2 Error
y
Point 3 Error
Intuitive Solution using Data Points 1, 2 3
Point 1 Error
x
9
Using All the Specified Points in the Analysis -
1.
  • If the Error at a given point i is defines
    as
  • Then Best Fit could be defined by the values of
    the constants that minimise

10
Using All the Specified Points in the Analysis -
2.
  • This approach is not so easy to analyse
  • A better approach is to minimise the Sum of
    (errors)2
  • the so called LEAST SQUARES Criteria
  • Where S is called the sum of the residuals

11
For our Straight Line Application
12
Solving for Constants a b
13
Least Squares Fit - Conclusions
  • These relationships involve all the data points
    specified
  • One could write a Java Program to read the data
    and work our the constants or
  • EXCEL has a wide range of REGRESSION facilities (
    which also return some diagnostics on how well
    the data fits the model - since you always get an
    answer even if the data doesnt fit the model by
    any reasonable intuitive meaning - you should
    always check how good the answer is).

14
Using EXCEL - TRENDLINEs -1.
  • First you must create a chart or graph of the
    given data
  • Use Excels Graph Wizard icon after
    highlighting the cells containing the given x and
    y data
  • Then pull open an area on your work sheet for the
    graph or select INSERT CHART for a separate sheet

15
Using EXCEL - TRENDLINEs -2.
  • For technical applications, always use the
    XYScatter Graph option - follow the other screen
    prompts to create a graph with straight line
    segments between each point
  • To insert a TRENDLINE select the graph by Left
    clicking on it with the mouse
  • Select INSERT TRENDLINE from the pull down Menu
    and follow the instructions
  • When finished you can check how well the
    generated Trendline fits the given data

16
CASE STUDY Fourier Series
  • A famous French Engineer, Fourier, proposed that
    reasonable functions could be expressed as the
    sum of sinusoids of different frequencies
  • f(x) -gt Sum of sinusoids - called Fourier
    Analysis
  • Sum of sinusoids -gt f(x) - called Fourier
    Synthesis

17
Typical Sinusoids
18
Fourier Series - 1.
  • If a function is periodic ( and meets a few other
    criteria for reasonable), then it may be
    represented by a Fourier Series and there are
    formulae for calculating the coefficients
    (amplitudes and phases of the sinusoids)
  • Important applications of this theory involve
    certain Electrical and Mechanical systems that
    are linear and Time/Shift Invariant).

19
Fourier Series Example
Show how a square wave can be created from its
Fourier Sine Series Components
A square wave comprises only odd harmonics
(1,3,5,7) (see Lab 2)
20
Fourier Series - 2.
  • Without developing the theory further - we can
    say that if we excite the system with a sinusoid
    of a certain frequency - then the response is
    also sinusoidal of the same frequency but with
    different amplitude and phase.
  • Moreover if the excitation consists of a sum of
    sinusoids, then the system responds to each
    sinusoid independently.
  • To determine what a system does to input f(x) we
    simply decompose f(x) into a sum of sinusoids

21
Fourier Series - 3.
  • Then work out the new amplitude and phase of each
    component from the equations describing the
    systems performance
  • Finally Add together the various sinusoids (
    using the new amplitudes and phases) to get the
    output

22
Damped Vibration Analysis
Example Shock Absorber in a car Assuming that
platform vibration is driven by the a square
wave, what how will the mass vibrate?
23
Mass Vibration Waveform
Plot of the mass vibration waveform using
1,3,5,7,9 harmonics of the platform driving
force waveform (See Lab 2)
Write a Comment
User Comments (0)
About PowerShow.com