Homework 3
Homework 3
2. In some applications one is faced with the problem of interpolating points which lie on
a curved path in the plane, for example in computer printing of enlarged letters. Often
the complex shapes (i.e., alphabet characters) cannot be represented as a function of x
because they are not single-valued. One approach is to use Parametric Interpolation.
Assume that the points along a curve are numbered P1 , P2 , ..., Pn as the curved path
is traversed and let di be the (straight-line) distance between Pi and Pi+1 . Then define
ti = ⌃i=1§
j=1 dj , for for i =1, 2, ..., n (i.e., t1 = 0, t2 = d1 , t3 = d1 +d2 , etc). If Pi = (xi , yi ), one
9.
can consider two sets of data (ti , xi ) and (ti , yi ) for i = 1, 2, ...n which can be interpolated
independently to generate \the functions f (t) and g(t), respectively. Then P (f (t), g(t))
for 0 t tn is a point in the plane and as t is increased from 0 to tn , P (t) interpolates
the desired shaped (hopefully!). Interpolation of the data given below via this method
should produce a certain letter. Adapt your algorithm from problem (1) to perform the
interpolations on f (t) and g(t) where t is increased from 0.0 to 12.0 in steps of dt (see
data below). Report the value of dt you use to achieve ‘reasonable’ results. Turn in a
plot of your interpolated shape (not the numeric values of P (t)) as well as plots of f (t)
and g(t) individually. [3 points]
ti xi yi
0.0 0.70 2.25
1.0 1.22 1.77
2.0 2.11 1.61
3.0 3.07 1.75
4.0 3.25 2.30
5.0 2.80 2.76
6.0 2.11 2.91
7.0 1.30 2.76
8.0 0.70 2.25
9.0 0.45 1.37
10.0 0.88 0.56
11.0 2.00 0.08
12.0 3.25 0.25
3. Repeat problem (2) with a natural cubic spline. Also report all four coefficients for each
of the cubics which comprise the interpolants for both f (t) and g(t). How does your letter
compare with that produced in problem (2)? Explain any di↵erences. [3.5 points]
1
DS 288 (AUG) 3:0 Numerical Methods Homework–3
the envelop of such a vibration (i.e., the curve through the peaks of the oscillations) is an
exponential function of the form
2⇡ax
y = be
where x is the cycle number, y is the corresponding amplitude and a is a damping factor.
Using the three data points shown in the figure, determine a and b that result from a best
fit based on the least-squares criterion. Use a linear least squares approach by suitable
change of variable. You may solve this problem “by hand” if you wish.
viscous damping
2
Least
Ans -147
change of
: with variables :
square
-
-
-2ha se
be
Y=
lnb-2-aa.se
lny
=
y
'
= b' + a' a
{ !÷?!aa
b' = tub
NOW ,
Errol E = EM [
'
( b' + a'se ) ]2
yi
-
,
i
izl
IIb ,
= 0 2
Em Kyi .
-
Cbi a' RID
-
c- 17=0
i-4
-
①
m
JE
and
{ Yi Cb taxi )
]
'
C-
0 => 2 [ Ri )=o
-
ga .
E- I -
From ① & ②
ZKFEY ;
'
b = -
2- seiyi Eni
MERY -
Exit
' MERIT ; -
EXiEYi
a =
MERY -
fait
en
given question .
| / gz.|gg#zg.,s-sgz/ |
Xi Yi Yi '=lnyi Xiii xi2
,, ago
b' = 1280×6.63986-86.6576×48
3×1280 -
4832
lnb = 2.825167
b= 16.8638
NOW ,
3×86.6576 48×6-63986
a'
-
2
3×1280 -
µ 8)
Laa = -
O -
0382425
A = 6.0865×10-3
(0-0382425) se
16.8638 e-
Y=
→ Non tinea Least Square : -
-
Errol Z( yi
Maki
)2
-
.
E= -
be
Iet
28 =° Em (
Yi
-
bé2aaki)é2aaxi = ☐
☒ i. i -
}±a=o Em (Yi -
be
-2mi
)(xié2aani)=o
i- I
-
egn ① &
@ cannot be solved for
' '
and
'
b' if exactly
this
nonlinear
a we use
,
least method
square .