a note on plotting curves

4
comprers & swucrures Vol. 19. No. 3, pp. 491-SOQ, 1984 004~7!949/84 s3.00 + .oo Printedin the U.S.A. Pergamon Press Ltd. TECHNICAL NOTE A NOTE ON PLOTTING CURVES s. h.JASEKARAN t Institute fur Baustatik, University of Stuttgart, 7000 Stuttgart-80, West Germany 93 (RCeioed 18 February 1983; receioed for publication 21 March 1983) Ah&net-In this note it is pointed out that sometimes there may be difficultiesin plotting a curve using the well known interpolation techniques, and in such cases, “isoparametric style of” interpolation may be used for better accuracy. INTRODUCTION It is usual to plot the curves using any of the interpolation formula such as Newton’s divided difference, Lagrangian Interpolation or Least Square Fitting. It is well known fact that the interpolation in general, polynomial interpolation in particular behaves very badly near the extremities of the region of definition. In this note it is suggested that the real curve may better be interpolated using the method similar to “isoparametric style” of interpolation and an example shows the accuracy of the method. NEWTON’S DIVIDED DIFFERENCE This is applied to equal as well as to unequal intervals. Consider a table of Xi, Yrvalues (i = 0 to n). Since there are (n + 1)points, it is possible to interpolate mth degree polynomial (if the mth deriva- tive is constant where m G n) (see Fig. 1). The mth degree polynomial is written as Y = a0 t ar(X -X0) t az(X -X0)(X - Xr) t . . t a,(X - X0)(X-Xl) . . . (X - X,-r) (1) where where aa = Ya; ar = YIO/XIO; a2 = (Y20- d20YX20X2~ a3=(YlO_crlX~-(r2X~X3,)/X,OX,IX~2 (2) Yrk = Yr - Yk and Xi, = Xi - Xk (3) It is usual to plot the curve by knowing the values of ao - am and dividing the interval XO to X, into p parts as and finding the value of Yr for any value of Xi. LAGRANGMNINTERPOLATION This is the formula most commonly used (see Fig. 2). The interpolating polynomial may be written as tGuest professor (Alexander von Humboldt Stiftung), Institute fir Baustatik, University of Stuttgart, W. Germany (on leave from P.S.G. College of Technology, India). where (6) For the same number of points and degree of interpolation Newton’s divided difference and Lagrangian Interpolation are identically the same. It has been pointed out by Irons and Ahmad [l] by comparing the Lagrangian interpolation with Sine curve, in the region of interest, near the ends it behaves progressively more wildly. This phenomena can be accentuated by round off errors, but it also occurs where round off errors are insignificant.It occurs also in the problem of “Least Square Fitting”. EXAMPLE It is required to fit a cubic polynomial passing through four points (which represents the side AB of the curved beam element shown in Fig. 3) given in the Table 1. Table 1. Table of values 1 X Y 0 166.28 98.88 I 173.866 76.586 2 178.452 53.4 3 180.0 30.0 The actual curve passing through the above points is Y = d(1802- X2) t 30. (7) The results from the Newton’s Divided Difference or Lagrangian Interpolation between the region of interest 166.28 G X < 180.0 are tabulated in Table 2 and compared with the actual values. -x x, Xl X2 X3 G-1 X” Fig. 1. Nth degree curve through (N + 1) points. 497

Upload: s-rajasekaran

Post on 21-Jun-2016

219 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: A note on plotting curves

comprers & swucrures Vol. 19. No. 3, pp. 491-SOQ, 1984 004~7!949/84 s3.00 + .oo

Printed in the U.S.A. Pergamon Press Ltd.

TECHNICAL NOTE

A NOTE ON PLOTTING CURVES

s. h.JASEKARAN t

Institute fur Baustatik, University of Stuttgart, 7000 Stuttgart-80, West Germany 93

(RCeioed 18 February 1983; receioed for publication 21 March 1983)

Ah&net-In this note it is pointed out that sometimes there may be difficulties in plotting a curve using the well known interpolation techniques, and in such cases, “isoparametric style of” interpolation may be used for better accuracy.

INTRODUCTION

It is usual to plot the curves using any of the interpolation formula such as Newton’s divided difference, Lagrangian Interpolation or Least Square Fitting. It is well known fact that the interpolation in general, polynomial interpolation in particular behaves very badly near the extremities of the region of definition. In this note it is suggested that the real curve may better be interpolated using the method similar to “isoparametric style” of interpolation and an example shows the accuracy of the method.

NEWTON’S DIVIDED DIFFERENCE

This is applied to equal as well as to unequal intervals. Consider a table of Xi, Yr values (i = 0 to n). Since there are (n + 1) points, it is possible to interpolate mth degree polynomial (if the mth deriva- tive is constant where m G n) (see Fig. 1).

The mth degree polynomial is written as

Y = a0 t ar(X -X0) t az(X -X0)(X - Xr) t . .

t a,(X - X0)(X-Xl) . . . (X - X,-r) (1)

where

where

aa = Ya; ar = YIO/XIO;

a2 = (Y20- d20YX20X2~

a3=(YlO_crlX~-(r2X~X3,)/X,OX,IX~2

(2)

Yrk = Yr - Yk and Xi, = Xi - Xk (3)

It is usual to plot the curve by knowing the values of ao - am and dividing the interval XO to X, into p parts as

and finding the value of Yr for any value of Xi.

LAGRANGMN INTERPOLATION This is the formula most commonly used (see Fig. 2). The

interpolating polynomial may be written as

tGuest professor (Alexander von Humboldt Stiftung), Institute fir Baustatik, University of Stuttgart, W. Germany (on leave from P.S.G. College of Technology, India).

where

(6)

For the same number of points and degree of interpolation Newton’s divided difference and Lagrangian Interpolation are identically the same. It has been pointed out by Irons and Ahmad [l] by comparing the Lagrangian interpolation with Sine curve, in the region of interest, near the ends it behaves progressively more wildly. This phenomena can be accentuated by round off errors, but it also occurs where round off errors are insignificant. It occurs also in the problem of “Least Square Fitting”.

EXAMPLE It is required to fit a cubic polynomial passing through four points

(which represents the side AB of the curved beam element shown in Fig. 3) given in the Table 1.

Table 1. Table of values

1 X Y

0 166.28 98.88 I 173.866 76.586 2 178.452 53.4 3 180.0 30.0

The actual curve passing through the above points is

Y = d(1802- X2) t 30. (7)

The results from the Newton’s Divided Difference or Lagrangian Interpolation between the region of interest 166.28 G X < 180.0 are tabulated in Table 2 and compared with the actual values.

-x x, Xl X2 X3 G-1 X”

Fig. 1. Nth degree curve through (N + 1) points.

497

Page 2: A note on plotting curves

498 Technical Note

I:~yo~~yn y 0 XI X2 X3 &l

1 1 h______

uJofx)

A___ 1 @, lx)

-- -

Fig. 2. Lagrangian interpolation.

Fig. 3. Plot of the cubic curve using Lagrangian interpolation.

Fig. 4. Plot of the quadratic curve using Lagrangian interpolation.

Page 3: A note on plotting curves

Technical Note 499

A B C D k I

620 E.O.333 E: 0.666 E = 1.0

PARENT CURVE (FOR 3 DEGREE 1

Y

B C D 16. - A

L_ -x

ACTUAL CURVE

Y)

A B C I- I

*F-q

E= 0 E= 0.5 E=lO

PARENT CURVE IFOR 2 DEGREE 1 ACTUAL CURVE

Fig. 5. Parent and actual elements.

It is seen from the table that it behaves wildly near the ends and good comparison is obtained near the centre region. The plot using the above interpolation is shown in Fig. 3. Such kind of wildly shape is obtained if three points and a second degree curve is fit using the Newton’s Divided difference on Lagrangian interpolation methods. The plot of the element for the second degree interpolation is shown in Fig. 4.

PROPOSED INl’RRPOLATlON

As used in Isoparametric element, the parent element of any curve is shown in Fig. S. Lagrangian interpolation functions for the parent element in terms of non-dimensional coordinate 5 can be written as

NA = (5 - 0.333)(6 -0.666X1 - 1) (- 0.333)( - 0.666)( - 1)

5(5 -0.666X5 - 1) Na = (0.333)( - 0.333X - 0.667)

(8-a)

(8-b)

5(6-0.333x5 - 1) Nc = (0.667)(0.333)( - 0.333)

ND = C([ -0.333x5 - 0.666) 0.667(0.333) (8-d)

0 1 I 1 i

EO El E2 EP

l-J%

Table 2

X Y Y (actual)

166.966 91.877 97.2633 167.652 86.490 95.519 168.338 82.514 93.7363 169.024 79.74 91.85 169.71 77.%2 89.9876 170.3% 76.972 88.116 Bad 171.082 76.564 85.95 171.768 76.53 84.085 172.454 76.664 81.571 173.147 76.758 79.2193 173.826 78.686 76.7388 174.512 76.0816 74.102 175.198 74.736 71.2996 Good 175.884 72.683 68.2729 176.57 69.396 64.97 177.256 64.9075 61.31 177.942 58.931 57.141 178.628 51.2584 52.1812 Bad 179.314 41.684 45.7 180.0 30.0 30.0

‘f _J L_- iX,,Y,)

X

Fig. 6. Division of parent and real curve into P parts.

Page 4: A note on plotting curves

500

Table 3.

Technical Note

X Y Y (actual)

167.608 95.618 95.629 168.871 92.32 92.31 170.066 88.995 88.97 171.193 85.639 85.614 172.254 82.255 82.2356 173.2475 78.847 78.839 174.173 75.417 75.4283 175.031 71.968 72.0 175.821 68.503 68.56 176.543 65.022 65.10695 177.197 61.531 61.64 177.783 58.03 58.1623 178.3 54.5233 54.68 178.74 51.011 51.177 179.13 47.49 47.67 179.44 43.987 44.158 179.685 40.478 40.63 179.859 36.976 37.114 179.9642 33.4826 33.59 180.0 30.0 30.0

an;

NE, NC, ND, Nc (0) NA, NB, ’ ND 1

XA XB XC XD YA YB yc YD (9)

Dividing the interval O-l into p parts, we get X and Y coordinate of Fig. 7. Plot of the cubic curve using isoparametric style of various points and the curve can be drawn. interpolation.

.

NAO NBO Nco NW : NAI NBI NCI NDI :

NAP NBP NCP NDP : ______________________:____---------- _________

i NAO Nso Nco NW

: NAI NBI NCI NDI

i NAP NBP NCP NDP

XA

XB XC XD , YA YB YC YD , (10)

The results obtained from this interpolation are compared with the actual values in Table 3 and it is seen that there is an excellent agreement. The plot is shown in Fig. 7.

fruitful discussions, and also Prof. Dr. E. Ramm for providing the necessary facilities for the preparation of this note. The author also thanks the Alexander von Humboldt Foundation for providing the fellowship to the author.

CONCLUSION

It is hetter to use the “Iso-narametric type of representation” of the shape function to plot the curves rather than simply using the usual interpolations. REFERENCE

1. B. Irons and 8.. Ahmad, Technioues of finite elements, Ellis, Acknowledgements-The author thanks Peter Osterider for the London (1980).