- +1-530-264-8006
- info@tutorsglobe.com

18,76,764

Questions

Asked

21,311

Experts

9,67,568

Questions

Answered

Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!

Submit Assignment
## Polynomial and Spline Interpolation

Polynomial and Spline Interpolation::A Chemical ReactionIn a chemical reaction the concentration intensity y of the product at time t was measured each half hour. The subsequent results were found:

We are able to input this data into Mat lab as

> t1 = 0:.5:2

> y1 = [ 0 .19 .26 .29 .31 ]

and plot the data with:

>plot(t1,y1)

Mat lab automatically connects the data with line segments. This is the simplest type of interpolation meaning fitting a graph (of a function) between data points. What if we desire a smoother graph? Try

>plot(t1,y1,’*’)

which will produce now asterisks at the data points. After that click on Tools then click on the Basic Fitting option. This must produce a small window with several fitting options. Start clicking them one at a time clicking them off before clicking the next. Which ones generate a good looking fit? You must note that the spline the shape-preserving interpolant as well as the 4th degree polynomial produce very good curves. The others don’t. We will confer polynomial interpolation as well as spline interpolation in this lecture.

:Polynomial FittingThe mainly universal degree n polynomial is:

p

_{n}(x) = a_{n}x^{n}+ a_{n−1}x^{n−1 }+ . . . + a_{1}x + a_{0}.If we have precisely n + 1 data points that is enough to exactly determine the n + 1 coefficients of pn(x) (as long as the data doesn’t have repeated x values). If there are more data points that would give us an over determined system (more equations than unknowns) as well as if there is less data the system would be undetermined.

On the other hand if we have n data points then an n−1 degree polynomial has exactly sufficient coefficients to fit the data. This is the case in the instance above there are 5 data points therefore there is exactly one 4th degree polynomial that fits the data.

When we tried to use a 5th or higher degree polynomial Matlab returned a warning that the polynomial is not unique since ‘degree >= number of data points’.

When we tried a lower degree polynomial we didn’t get a warning however we did notice that the resulting curve doesn’t hit all the data points. If there was an in excess of determined system how did Mat lab come up with a pretty good approximation (for cubic)? The respond is the Least Squares Method.

Predicting the future?Suppose we want to utilize the data to extrapolate into the future. Locate the plot to the 4th degree polynomial. Then click the Edit button as well as select the Axes Properties option. A box must appear that allows you to adjust the domain of the x axes. Modify the upper limit of the x-axis from 2 to 4. On the Basis of 4th degree polynomial what will the chemical reaction do in the future?

Is this reasonable?After that change from 4th degree polynomial to spline interpolant. As-per to the spline what will the chemical reaction do in the future? Try the shape-preserving interpolant as well.

From our (limited) knowledge of chemical reactions what must be the behaviour as time goes on? It must reach a limiting value (chemical equilibrium). Could we utilize the data to predict this equilibrium value? Of course we could along with it is done all the time in many different contexts although to do so we need to know that there is equilibrium to predict. This requires that we recognize the chemistry of the problem. Therefore we have the following principle: To extrapolate beyond the data one must have a few knowledge of the process.

:More dataIn general one would think that more data is better. Input the subsequent data vectors

> t2 = [ 0 .1 .4 .5 .6 1.0 1.4 1.5 1.6 1.9 2.0]

> y2 = [ 0 .06 .17 .19 .21 .26 .29 .29 .30 .31 .31]

There are 11 data points therefore a 10-th degree polynomial will fit the data. However, this does not give a good graph. Thus: A polynomial fit is better for small data sets.

Ultimately we note that every data point (xi, yi) gives an equation:

pn(x

_{i}) = a_{0}+ a_{1}x_{i}+ a_{2}x_{2i}+ • • • + a_{n}x_{ni}= y_{i}.The unknowns are the coefficients a

_{0}, . . . , a_{n}. This equation is linear in these unknowns, so determining a polynomial fit requires solving a linear system of equations. This makes polynomial fits speedy to calculate since solving linear systems is what computers do best.:A challenging data setInput the subsequent data set:

> x = -4:1:5

> y = [ 0 0 0 1 1 1 0 0 0 0]

and plot it:

>plot(x,y,’*’)

There are 10 data points therefore there is a unique 9 degree polynomial that fits the data. Under Tools as well as Basic Fitting select the 9th degree polynomial fit. How does it appear? De-select the 9th degree polynomial as well as select the spline interpolant. This must produce a much more satisfactory graph and the shape-preserving spline must be even better. In this section we study what a spline is.

:The idea of a splineThe general idea of a spline is these on every interval between data points represent the graph with a simple function. The simplest spline is something extremely familiar to you it is acquired by connecting the data with lines. Since linear is the main simple function of all linear interpolation is the simplest form of spline. The subsequent simplest function is quadratic. If we put a quadratic function on every interval then we should be able to make the graph a lot smoother. If we were actually careful then we should be able to make the curve smooth at the data points themselves by matching up the derivatives. This is able to be done and the result is called a quadratic spline. Utilizing cubic functions or 4th degree functions should be smoother still. Therefore where should we stop? There is an approximately universal consensus that cubic is the optimal degree for splines as well as so we focus the rest of the lecture on cubic splines.

:Cubic splineOnce more the essential idea of the cubic spline is that we represent the function by a different cubic function on every interval between data points. Specifically if there are n data points then the spline S(x) is the function

where every Ci is a cubic function. The generally general cubic function has the form

C

_{i}(x) = a_{i}+ b_{i}x + c_{i}x^{2}+ d_{i}x^{3}.To determine the spline we should determine the coefficients, a

_{i}, b_{i}, c_{i}, and d_{i}for each i. Since there are n intervals, there are 4n coefficients to determine. First we require that the spline be exact at the data:C

_{i}(x_{i−1}) = y_{i−1}and C_{i}(x_{i}) = y_{i},at every data point. In other words,

a

_{i}+ b_{i}x_{i−1}+ c_{i}x^{2}_{i}_{−1}+ d_{i}x^{3}_{i−1}= y_{i−1 }and a_{i}+ b_{i}x_{i}+ c_{i}x^{2}_{i}+ d_{i}x^{3}_{i}= yi.Note that there are 2n of these conditions. Then to make S(x) as smooth as probable we require:

C′

_{i}(x_{i}) = C′_{i+1}(x_{i})C′′

_{i}(x_{i}) = C′′_{i+1}(x_{i}),at each the internal points, i.e. x

_{1}, x_{2}, x_{3}, . . . , x_{n−1}. In terms of the points these conditions are able to be written as:b

_{i}+ 2c_{i}x_{i}+ 3d_{i}x^{2}_{i }= b_{i+1}+ 2c_{i+1}x_{i}+ 3d_{i+1}x^{2}_{i}2c

_{i}+ 6d_{i}x_{i}= 2c_{i+1}+ 6d_{i+1}x_{i}.There are 2(n − 1) of these conditions. Since each Ciis cubic there are a total of 4n coefficients in the formula for S(x). Therefore far we have 4n − 2 equations thus we are 2 equations short of being able to determine all the coefficients. At the present we have to make a choice. The typical choice is to require

C′′

_{1 }(x_{0}) = C′′_{n}(x_{n}) = 0.These are called natural or else simple boundary conditions. The other common alternative is called clamped boundary conditions:

C′

_{1}(x_{0}) = C′_{n}(x_{n}) = 0.The terminology used here is observably parallel to that used for beams. That isn’t the only parallel between beams and cubic splines. It is an interesting statement that a cubic spline is exactly the shape of a (linear) beam restrained to match the data by simple supports.

Note that the equations above are every linear equations with respect to the unknowns (coefficients). This feature makes splines simple to calculate since solving linear systems is what computers do best.

Latest technology based Matlab Programming Online Tutoring AssistanceTutors, at the

www.tutorsglobe.com, take pledge to provide full satisfaction and assurance inMatlab Programming helpviaonline tutoring. Students are getting 100% satisfaction byonline tutorsacross the globe. Here you can get homework help for Matlab Programming, project ideas and tutorials. We provide email basedMatlab Programming help. You can join us to ask queries 24x7 with live, experienced and qualified online tutors specialized in Matlab Programming. ThroughOnline Tutoring, you would be able to complete your homework or assignments at your home. Tutors at theTutorsGlobeare committed to provide the best qualityonline tutoringassistance forMatlab Programming Homework helpandassignment helpservices. They use their experience, as they have solved thousands of the Matlab Programming assignments, which may help you to solve your complex issues of Matlab Programming.TutorsGlobeassure for the best quality compliance to your homework. Compromise with quality is not in our dictionary. If we feel that we are not able to provide thehomework helpas per the deadline or given instruction by the student, we refund the money of the student without any delay.