Professional Documents
Culture Documents
Topographic Contour and Curve Fitting
Topographic Contour and Curve Fitting
Topographic Contour and Curve Fitting
Mahesh Shrivastava
What is the elevation of point A and C ?
What is the slope between points A and C?
points of 105
points of 100 100
98 102
100 105
D
101 108
105
Questions 1:
Make the contour of the map 0.5unit
1.5 1.0 1.5 1.5 1.0 1.5
x
Data distribution
x
Data distribution and straight line fit
x
Least Squares Method
2 2 2 2
Error = ∑ d i2 = [y1 − f (x1 )] + [y2 − f (x2 )] + [y3 − f (x3 )] + [y4 − f (x4 )]
N N
2 2
Error = ∑ [yi − f (xi )] = ∑ [yi − (axi + b )]
i =1 i =1
•The ‘best’ line has minimum error between line and data points
•This is called the least squares approach, since square of the error
is minimized.
N
⎧ 2⎫
Minimize⎨ Error = ∑ [yi − (axi + b )] ⎬
⎩ i =1 ⎭
Take the derivative of the error with respect to a and b, set each to zero
⎛ N 2⎞
∂⎜ ∑ [yi − (axi + b )] ⎟
∂ (Error )
= ⎝ i =1 ⎠ =0
∂a ∂a
⎛ N 2⎞
∂⎜ ∑ [yi − (axi + b )] ⎟
∂ (Error )
= ⎝ i =1 ⎠ =0
∂b ∂b
∂ (Error ) N
= −2∑ xi [yi − (axi + b )] = 0
∂a i =1
∂ (Error ) N
= −2∑ [yi − (axi + b )] = 0
∂b i =1
Solve for the a and b so that the previous two equations both = 0
N N N
2
a ∑ x + b∑ xi = ∑ xi yi
i
i =1 i =1 i =1
N N
a ∑ xi + bN = ∑ yi
i =1 i =1
N
⎡ ⎤ ⎡N ⎤
⎢N ∑ xi ⎥
b ⎢ ∑ yi ⎥
⎢ i =1
⎥ ⎡⎢ ⎤⎥ = ⎢ i =1 ⎥
⎢N N
⎥
2 ⎣ ⎦ a ⎢ N
⎥
⎢∑ xi ∑ xi ⎥ ⎢∑ xi yi ⎥
⎣ i =1 i =1 ⎦ ⎣ i =1 ⎦
N N N
N ∑ xi yi − ∑ xi ∑ yi
i =1 i =1 i =1
a= 2
N N
⎡ ⎤
2
N ∑ x − ⎢∑ xi ⎥i
i =1 ⎣ i =1 ⎦
N N N N
2
∑ y ∑x −∑x ∑x
i =1
i
i =1
i
i =1
i
i =1
i yi
b= 2
N N
⎡ ⎤
2
N ∑ x − ⎢∑ xi ⎥i
i =1 ⎣ i =1 ⎦
Linear Regression Analysis
N N
' '
a ∑ yi + b N = ∑ xi
i =1 i =1
N
⎡ ⎤ ⎡N ⎤
⎢N ∑ yi ⎥ '
⎡b ⎤ ⎢ ∑ xi ⎥
i =1
⎢ ⎥ ⎢ ⎥ = ⎢ i =1 ⎥
⎢N N
⎥ ⎢
2 ⎣ ⎦ a '
⎥ ⎢ N
⎥
⎢ ∑ yi ∑ yi ⎥ ⎢∑ xi yi ⎥
⎣ i =1 i =1 ⎦ ⎣ i =1 ⎦
N N N
N ∑ xi yi − ∑ xi ∑ yi
' ' ' i =1 i =1 i =1
x = a y+b ⇒ a = 2
N N
⎡ 2 ⎤
N ∑ y − ⎢ ∑ yi ⎥
i
i =1 ⎣ i =1 ⎦
Recast the second fit line as:
1 b'
y = ' x− '
a a
1 is the slope of this second line, which not same as
a' the first line
•The ratio of the slopes of the two lines is a measure of
how good the form of the fit is to the data.
•In view of this the correlation coefficient ρ defined
through the relation
⎧ N N N
⎫
⎨ N ∑ xi yi − ∑ xi ∑ yi ⎬
ρ =± ⎩ i =1 i =1 i =1 ⎭
⎧⎪ N 2 ⎡ N ⎤ 2 ⎫⎪⎧⎪ N 2 ⎡ N ⎤ 2 ⎫⎪
⎨ N ∑ xi − ⎢∑ xi ⎥ ⎬⎨ N ∑ yi − ⎢∑ yi ⎥ ⎬
⎪⎩ i =1 ⎣ i =1 ⎦ ⎪⎭⎪⎩ i =1 ⎣ i =1 ⎦ ⎪⎭
ρ2=1.000 ρ2=0.991 ρ2=0.904
N N N N N N N
2
N ∑ xi yi − ∑ xi ∑ yi ∑ y ∑x −∑x ∑x
i =1
i
i =1
i
i =1
i
i =1
i yi
a= i =1 i =1 i =1 b= 2
2 N
N
⎡ N
⎤ ⎡N ⎤
2
N ∑ xi2 − ⎢∑ xi ⎥ N ∑ x − ⎢∑ xi ⎥
i
i =1 ⎣ i =1 ⎦ i =1 ⎣ i =1 ⎦
Find out the curve model and correlation of following data sets.
(i)
x 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
y 2 3 6 4 5 7 9 9 10 11
(ii)
x 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
y 11 10 9 8 6 5 5 5 4 2