Sei sulla pagina 1di 4

Assignment

Numerical Methods

Numerical Analysis

Spline Method

Problem Statement: A given data for the movement of robotic arm gives a long path after using a 5th
degree polynomial interpolation. The given data is:
x (in.)
y (in.)
Find a solution that fits this data with a smooth function to avoid damage to
2.00
7.2
arm?
Solution:

4.25

7.1

In the mathematical field of numerical analysis, Runge's phenomenon is a


problem of oscillation at the edges of an interval that occurs when using
polynomial interpolation with polynomials of high degree over a set of equispaced interpolation points. It was discovered by Carl David Tolm Runge when
exploring the behavior of errors when using polynomial interpolation to
approximate certain functions. He proposed spline method of interpolation to
be a better alternative. To solve the given problem, we will use quadratic spline
method.

5.25

6.0

7.81

5.0

9.20

3.5

10.60

5.0

y ( x ) a1 x 2 b1 x c1 ,

2.00 x 4.25

a 2 x 2 b2 x c 2 ,

4.25 x 5.25

a 3 x 2 b3 x c3 ,

5.25 x 7.81

a 4 x 2 b4 x c 4 ,

7.81 x 9.20

a 5 x 2 b5 x c5 ,

9.20 x 10.60

Here, we have represented a degree two polynomial to interpolate consecutive data points. As each
polynomial is defined on two values of given data i.e, a x b , we can evaluate polynomial at a and
b two get 2n equations for n quadratic functions. But these are not enough to evaluate all unknowns.
As the first derivatives are continuous at interior points, this gives us

UET, Pakistan

1|Page

Numerical Analysis

Spline Method

The first derivatives of two quadratic splines are continuous at the interior points.
For example, the derivative of the first spline
a1 x 2 b1 x c1 is

2 a1 x b1

The derivative of the second spline


a 2 x 2 b2 x c 2 is

2 a2 x b2

and the two are equal at x x1 giving


2 a1 x1 b1 2a 2 x1 b2
2 a1 x1 b1 2a 2 x1 b2 0
Continuing in this fashion, we get 3n equations and 3n unknowns but we assume a1=0, so we need 3n-1
equations:
1.

a1 ( 2.00) 2 b1 ( 2.00) c1 7.2

2.

a1 ( 4.25) 2 b1 ( 4.25) c1 7.1

3.

a 2 (4.25) 2 b2 ( 4.25) c 2 7.1

4.

a 2 (5.25) 2 b2 (5.25) c 2 6.0

5.

a 3 (5.25) 2 b3 (5.25) c3 6.0

6.

a 3 (7.81) 2 b3 (7.81) c 3 5.0

7.

a 4 (7.81) 2 b4 (7.81) c 4 5.0

8.

a 4 (9.20) 2 b4 (9.20) c 4 3.5

9.

a 5 (9.20) 2 b5 (9.20) c5 3.5

10.

a 5 (10.60) 2 b5 (10.60) c5 5.0

Using derivatives:
At x=4.25

2a1 ( 4.25) b1 2a 2 ( 4.25) b2 0


At x 5.25

2a 2 (5.25) b2 2a 3 (5.25) b3 0
At x 7.81

2a 3 (7.81) b3 2a 4 (7.81) b4 0
At x 9.20

2a 4 (9.20) b4 2a 5 (9.20) b5 0

2|Page

UET, Pakistan

Numerical Analysis

Spline Method

Using Matlab to evaluate the coefficients:


>> b=zeros(15,15);
>> b(1,:)=a+[4 2 1 0 0 0 0 0 0 0 0 0 0 0 0];

%a=zeros(1,15);

>> b(2,:)=a+[18.063 4.25 1 0 0 0 0 0 0 0 0 0 0 0 0];


>> b(3,:)=a+[0 0 0 18.063 4.25 1 0 0 0 0 0 0 0 0 0];
>> b(4,:)=a+[0 0 0 27.563 5.25 1 0 0 0 0 0 0 0 0 0];
>> b(5,:)=a+[0 0 0 0 0 0 27.563 5.25 1 0 0 0 0 0 0];
>> b(6,:)=a+[0 0 0 0 0 0 60.996 7.81 1 0 0 0 0 0 0];
>> b(7,:)=a+[0 0 0 0 0 0 0 0 0 60.996 7.81 1 0 0 0];
>> b(8,:)=a+[0 0 0 0 0 0 0 0 0 84.64 9.2 1 0 0 0];
>> b(9,:)=a+[0 0 0 0 0 0 0 0 0 0 0 0 84.64 9.2 1];

1.0556

0.68943

1.7651

3.2886

>> b(10,:)=a+[0 0 0 0 0 0 0 0 0 0 0 0 112.36 10.6 1];


>> b(11,:)=a+[8.5 1 0 -8.5 -1 0 0 0 0 0 0 0 0 0 0];
>> b(12,:)=a+[0 0 0 10.5 1 0 -10.5 -1 0 0 0 0 0 0 0];
>> b(13,:)=a+[0 0 0 0 0 0 15.62 1 0 -15.62 -1 0 0 0 0];
>> b(14,:)=a+[0 0 0 0 0 0 0 0 0 18.4 1 0 -18.4 -1 0 ];
>> a(1)=1;

0.044444

7.2889

8.9278

11.777

9.3945

36.319

28.945

113.40

64.042

314.34

>> b(15,:)=a;
>> c=[7.2 7.1 7.1 6.0 6.0 5.0 5.0 3.5 3.5 5.0 0 0 0 0 0];
>> x=b\(transpose(c));

y ( x) 0.044444 x 7.2889,

2.00 x 4.25

1.0556 x 2 8.9278 x 11.777,

4.25 x 5.25

0.68943x 2 9.3945 x 36.319,

5.25 x 7.81

1.7651x 2 28.945 x 113.40,

7.81 x 9.20

3.2886 x 2 64.042 x 314.34,

9.20 x 10.60
UET, Pakistan

3|Page

Potrebbero piacerti anche