204x Filetype PDF File size 0.06 MB Source: www.math.wsu.edu
PRECALCREVIEW:MODELINGwithFUNCTIONSI
Modeling with Linear Functions
• Basic Linear Function is y = mx + b, with slope m and y−intercept b.
Alternate (point-slope) form y = y +m(x−x ), given one data point (x ,y ).
1 1 1 1
• Important Application is Data Fitting (linear regression): given x,y data,
find the “best-fit” line for the data.
Example: Columbia River Depth vs Flow Velocity Data (Problem 1.2.45)
Problem 45 River Data Channel Flow Velocity as funciton of River Depth
1.6
1.4
1.2
1
Flow Velocity0.8
0.6
0.4
0.20 2 4 6 8 10 12
Depth in Feet
Data value lists for x and y
x = [ .7 2 2.6 3.3 4.6 5.9 7.3 8.6 9.9 10.6 11.2];
y = [1.55 1.11 1.42 1.39 1.39 1.14 .91 .59 .59 .41 .22];
2
PRECALCREVIEW:MODELINGwithLINEARFUNCTIONS
Modeling problem: how to find good m and b values for y = mx + b.
Some possibilities:
a) use first two data values: slope m = (y2 − y1)/(x2 − x1) ≈ −.3385.
b) use first and last data values: slope m = (y −y )/(x −x )≈−.1267.
11 1 11 1
c) use all data values to find “best-fit” line:
using calculus and Matlab m = −.1165, b = 1.681.
Problem 45 River Data Fit Lines
2
1.5
1
0.5
0
−0.5
−1
−1.5
−2
−2.50 2 4 6 8 10 12
Estimated river velocity with 12 ft depth is ?
3
Math formulas for best-fit line slope and intercept:
nPxy −Px Py Py −mPx
i i i i i i
m= P 2 P 2 , b= ;
n x −( x) n
i i
Matlab instructions for previous graph
x = [.7 2 2.6 3.3 4.6 5.9 7.3 8.6 9.9 10.6 11.2];
y = [1.55 1.11 1.42 1.39 1.39 1.14 .91 .59 .59 .41 .22];
p = polyfit( x, y, 1 ); m = p(1), b = p(2)
m1 = (y(2)-y(1))/(x(2)-x(1));
m2 = (y(11)-y(1))/(x(11)-x(1));
plot(x,y,’*’,x,y(1)+m1*(x-x(1)),x,y(1)+m2*(x-x(1)),x,b+m*x)
4
PRECALCREVIEW:MODELINGwithFUNCTIONSCONT.
Modeling with Periodic Functions
• Basic Periodic Function is y = acos(bx) or y = acos(bx − c)
with amplitude |a|, period 2π/b, and phase shift c/b;
could also use y = acos(bx − c) + d or sin instead of cos.
• Model Application: need to find good values for a, b, and maybe c, d.
Example: some plotted data values
6
5
4
3
2
1
0
−1
−20 1 2 3 4 5 6 7 8 9 10
a?, b?, c?, d?.
no reviews yet
Please Login to review.