Graphics Reference
In-Depth Information
it now represents the difference between the exact values of the graph of
y = e ^ x
in 200 interpolation points
and its own points
(x
i
, y
i
)
. so you have a graphic idea of the error committed by using interpolation points instead
of the exact points. the error would be zero if the graph was reduced to the
x
axis. see Figure
6-2
:
>> zi=(exp(xi));
>> di=yi-zi ;
>> plot(xi,di)
Figure 6-2.
eXerCISe 6-7
Get 25 points of approach by interpolation of the parametric function X = Cos(t), y = sin (t), Z = tan(t) for values of
t
between 0 and
p
/6, on the set of points defined for values of t in the range 0
£
t
£
6.
First, we define the 25 given points
(x, y, z)
, equally spaced between 0 and
p
/
6.
>> t = 0: pi/150: pi/6;
>> x = cos(t); y = sin(t); z = tan(t);
now find the 25 points of interpolation
(x
i
, y
i
, z
i
),
for values of the parameter
t
equally spaced between 0 and
p
/6.
>> xi = cos(t); yi = sin(t);
>> zi = griddata(x,y,z,xi,yi);
>> points = [xi; yi; zi]'
points =
1.0000 0 0.0000
0.9998 0.0209 0.0161
0.9991 0.0419 0.0367
0.9980 0.0628 0.0598
0.9965 0.0837 0.0836
0.9945 0.1045 0.1057