Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numeriska beräkningar i Naturvetenskap och Teknik Today’s topic: Approximations Least square method Interpolations Fit of polynomials Splines.

Similar presentations


Presentation on theme: "Numeriska beräkningar i Naturvetenskap och Teknik Today’s topic: Approximations Least square method Interpolations Fit of polynomials Splines."— Presentation transcript:

1 Numeriska beräkningar i Naturvetenskap och Teknik Today’s topic: Approximations Least square method Interpolations Fit of polynomials Splines

2 Numeriska beräkningar i Naturvetenskap och Teknik An exemple Modell Why do the measured values deviate from the mode if the measurement is correct?

3 Numeriska beräkningar i Naturvetenskap och Teknik How determine the ‘best’ straight line? Model

4 Numeriska beräkningar i Naturvetenskap och Teknik Distance between line and measurements points...

5 Numeriska beräkningar i Naturvetenskap och Teknik How to define the distance between the line and the measurement points? Largest deviation at minimum Approximation in maximum norm Sum of deviations squared as small as possible Approximation in Euclidian norm Easier to calculate! Norm

6 Numeriska beräkningar i Naturvetenskap och Teknik Matrix formulation: An example with More equations than unknowns!

7 Numeriska beräkningar i Naturvetenskap och Teknik Matrix formulation: An exampe

8 Numeriska beräkningar i Naturvetenskap och Teknik Matrix formulation: An example

9 Numeriska beräkningar i Naturvetenskap och Teknik Matrix formulation: An example

10 Numeriska beräkningar i Naturvetenskap och Teknik General Statement of the Problem: Depending on the model, the measurement data can of course be described by other expressions than the straight line. In general terms one seeks a function f* that approximates f’s given values as good as possible in euclidian norm. Specifically, above we looked for a solution expressed as but we could as well have looked for a solution given by another function (possibly then for different data) etc...

11 Numeriska beräkningar i Naturvetenskap och Teknik Generally one can thus write: f(x) is in other words a linear combination of given functions Where the coefficients are sought One can in accordande with a vector space look at it so that Spans a function space (a space of this kind which fulfills certain conditions is called a Hilbert space, cmp. quant. mech)

12 Numeriska beräkningar i Naturvetenskap och Teknik In the case of the straight line we have In a geometrical comparision these two functions, which can be seen as two vectors in the function space, span a plane U: ”vector” 0 ”vector” 1 Approximating function sought function The smallest distance from the plane is given by a normal. The smallest deviation between f* och f is for f*-f orthogonal to the plane U!

13 Numeriska beräkningar i Naturvetenskap och Teknik Normal equations Since we are interested in fitting m measured values we leave the picture of the continuous function space and view f(x) as an m-dimensional vector with values: That should be expressed byand For the straight line:

14 Numeriska beräkningar i Naturvetenskap och Teknik The orthogonality condition now gives the equations: where the equations for the normal: Which gives

15 Numeriska beräkningar i Naturvetenskap och Teknik The equations for the normal :

16 Numeriska beräkningar i Naturvetenskap och Teknik Back to the exemple: Model:Data:

17 Numeriska beräkningar i Naturvetenskap och Teknik Conclusion: the minimum of is orthogonal to the basis vectors Assuming the modelGiven data is obtained when The coefficienterna c 1, c 2, c 3, c n are determined from

18 Numeriska beräkningar i Naturvetenskap och Teknik The equations or Where the colomuns in A are:

19 Numeriska beräkningar i Naturvetenskap och Teknik Note 1: The func’sHave to be linearly independent (cmp vectors in a vector space) Note 2: Assume our problem would have been (x koord -996) cmp to

20 Numeriska beräkningar i Naturvetenskap och Teknik Gauss’ elimination method:

21 Numeriska beräkningar i Naturvetenskap och Teknik Gauss’ elimination method:

22 Numeriska beräkningar i Naturvetenskap och Teknik Error sources 1. Mätdata, E f

23 Numeriska beräkningar i Naturvetenskap och Teknik Error sources 2. Truncation errorThese would be zero for a first degree polynomial

24 Numeriska beräkningar i Naturvetenskap och Teknik The approximation to data assumes to pass through the data points, i.e. one assumes the errors are small. Linear interpolation Alt for equidistant data Interpolation

25 Numeriska beräkningar i Naturvetenskap och Teknik Quadratic interpolation Ansatz 1 2 3

26 Numeriska beräkningar i Naturvetenskap och Teknik Quadratic interpolation 3

27 Numeriska beräkningar i Naturvetenskap och Teknik Quadratic interpolation Newton’s ansatz Uniqueness: There is only one polynomial of order m that passes through m+1 points.

28 Numeriska beräkningar i Naturvetenskap och Teknik Error interpolation Linear interpolation

29 Numeriska beräkningar i Naturvetenskap och Teknik Exemple Interpolation of polynomial of order 4,8,16 in equidistant points Fit of polynomial of order 6 to 9 equidistant points

30 Numeriska beräkningar i Naturvetenskap och Teknik 4th order 8th order 16th order 6th order in 9 points

31 Numeriska beräkningar i Naturvetenskap och Teknik Runge’s phenomenon Interpolation in equidistant points by a polynomal of high order tends to reproduce a curve better in the central parts of the interval but gives considerable oscillations close to the end-points of the interval! Chebychev polynomials and Chebychev abscissa If one can select the points in which data is known (this can be hard if the measurement values are already given… ) then the data points should be closer close to the end-points of the interval. An optimal choice is given by the zeros of the Chebychev polynomial of order m which minimizes the residue above.

32 Numeriska beräkningar i Naturvetenskap och Teknik Splines An alternative is to use a polynomial piece wise between the points. One can e.g. set the condition that the function’s values, its derivative and second derivative is equal in the end points of each short interval for polynomials that meet in these points. This approach gives so-called cubic splines. In the extreme end-points one can e.g. demand the curve to be straight.

33 Numeriska beräkningar i Naturvetenskap och Teknik Cubic splines FunctionDerivative Second derivative

34 Numeriska beräkningar i Naturvetenskap och Teknik Insertion: Function Derivative Second derivative

35 Numeriska beräkningar i Naturvetenskap och Teknik The condtions and give

36 Numeriska beräkningar i Naturvetenskap och Teknik the following system in matrix form: Easy to solve! Try out MATLABs spline function on your own!


Download ppt "Numeriska beräkningar i Naturvetenskap och Teknik Today’s topic: Approximations Least square method Interpolations Fit of polynomials Splines."

Similar presentations


Ads by Google