Docsity

Function Discovery: Linear, Power, and Exponential Functions for Physical Data, Slides of Calculus for Engineers

Partial preview of the text

Download Function Discovery: Linear, Power, and Exponential Functions for Physical Data and more Slides Calculus for Engineers in PDF only on Docsity!

Engr/Math/Physics 25

Chp6 MATLAB

Fcn Discovery

Learning Goals

  • Create “Linear-Transform” Math Models for

measured Physical Data

  • Linear Function → No Xform
  • Power Function → Log-Log Xform
  • Exponential Function → SemiLog Xform
  • Build Math Models for Physical Data using

“nth” Degree Polynomials

  • Use MATLAB’s “Basic Fitting” Utility to find

Math models for Plotted Data

Learning Goals cont

  • Build Math Models for Physical Data using

“nth” Degree Polynomials

  • Use MATLAB’s “Basic Fitting” Utility to find

Math models for Plotted Data

  • Use MATLAB to Produce 3-Dimensional

Plots, including

  • Surface Plots
  • Contour Plots

Function Discovery

  • Physical Processes for some Response (OutPut), y, as Resulting from some Excitation (InPut), x, can many times be approximated by 3 Functions
  1. The LINEAR function: y = mx + b
  • Produces a straight line with SLOPE a of m and an INTERCEPT of b when plotted on rectilinear axes
  1. The POWER function: y = bxm
  • gives a straight line when plotted on log-log axes
  1. The exponential function y = b·10mx^ or y = b·emx
  • Yields a straight line when plotted on a semilog plot with logarithmic y -axis

Power Function Xform

  • Thus the Power Function Takes the Form: ^ Yields a Staight Line  So if we suspect a PwrFcn, Plot the Data in Log-Log Form

ln y vs. ln x

 Example:

 

p p p

m m

Y mX B

y m x b

y bx b x

ln ln ln

ln ln

 If The Data Follows the Power Function Then a Plot of 7 91

13 1.^73

 

x

y x

Power Function y = 13x1.

  • Rectlinear Plot • Log-Log Plot

(^00 10 20 30 40 50 60 70 80 90 )

1

2

3

3.5 x 10^4

x

y

Power Function

5.51.5 2 2.5 3 3.5 4 4.5 5

6

7

8

9

10

ln(x)

ln(y)

Power Function

Exponential Function Xform

  • Recall the General form of the Exponential Fcn

 In This Case Let

 Then the Xformed Exponential Fcn

mx ybe

 Again taking the ln

y mx b

b mx e

y be mx

ln ln

ln ln

ln ln

 

 

e

e b B

y Y

ln

ln

YemxBe  A SemiLog (log-y) plot Should Show as a Straight Line

Exponential Fcn Plot

  • Plot v^ ^115 e^ ^0.^61 t  ln v  ^0.^61 t ln^115 

(^00 1 2 3 4 5 6 7 8 9 )

20

40

60

80

100

120

t

v

Exponential Function

-2 0 1 2 3 4 5 6 7 8 9 10

0

1

2

3

4

5

t

ln(v)

Exponential Function ln(115) = 4.

 Rectlinear Plot ^ SemiLog Plot

Steps for Function Discovery

  1. Examine the data near the origin.
    • The linear function can pass through the origin only if b = 0
    • The exponential function (y = bemx) can never pass through the origin
  • as et^ > 0 (positive) for ALL t; e.g., e−2.7^ = 0.
  • unless of course b = 0, which is a trivial case: y = 0·emx
    • The power function (y = bxm) can pass through the origin (e.g.; y = 7x^3 ) but only if m > 0 (positive) as
  • As y = bx-m^ = b/xm^ → Hyperbolic for negative m

“Discoverable” Functions

(^0) -5 0 5

50

100

150

x

ye

(^0) -5 0 5

5

10

15

20

25

x

ypp

(^0) -5 0 5

50

100

150

200

250

300

350

400

x

ypm

x

ye  e

y  x ^2

pp

y  x ^2

pm

 In most applications x is NONnegative

Steps for Function Discovery

  1. If you suspect a power function, then plot the data using log-log scales.
  • Only a power function will form a straight line on a log-log plot.
  1. If you suspect an exponential function, then plot the data using the SemiLogy scale.
  • Only an exponential function will form a straight line on a SemiLog plot.

mx

m

y be

y bx

y mx b

 

SemiLog and LogLog Scales

(^10) -5 0 5

10 -

10 -

100

101

102

103

x

ye

(^1010) -2 100 102

10 -

10 -

100

101

102

(^1010) -2 100 102

10 -

100

101

102

103

x

ypm

  • Note Change in power Function x-axis scales
    • In this case x MUST be POSITIVE

x

ye  e

y  x ^2

pp

y  x ^2

pm

The polyfit Function

  • The Command → p = polyfit(x,y,n)
    • This Function Fits a polynomial of degree n to data described by the vectors x and y, where x is the independent variable.
    • polyfit Returns a row vector p of length n + 1 that contains the polynomial coefficients in order of descending powers
  • Note That a FIRST Degree Polynomial Describes the Eqn of a LINE
    • If w =p 1 z +p 2 then polyfit on data Vectors W & Z returns: p = ployfit(Z,W,1) = [p 1 , p 2 ] → *m, b+

Using polyfit For Discovery

  • polyfit of degree-1 (n = 1) returns the parameters of a Line
  • p 1 → m (slope)
  • p 2 → b (intercept)
  • Thus polyfit can provide m & b for any of the previously noted functions AFTER the appropriate Linearization Transform