Lecture 5 Polynomial Approximation Polynomial Interpolation Example Limitation
- Slides: 44
Lecture 5 Polynomial Approximation ØPolynomial Interpolation ØExample ØLimitation ØPolynomial Approximation (fitting) ØLine fitting ØQuadratic curve fitting ØPolynomial fitting 數值方法 1
Polynomials P=poly([-4 0 3]); x=linspace(-5, 5); y=polyval(P, x); plot(x, y); 數值方法 Polynomial determined by zeros in [-4, 0, 3] Plot polynomial P 2
Sampling of paired data P=poly([-4 0 3]); x=rand(1, 6)*10 -5; y=polyval(P, x); plot(x, y, 'ro'); 數值方法 Produce a polynomial with zeros [-4, 0, 3] Plot paired data 3
Polynomial interpolation P=poly([-4 0 3]); n=6 x=rand(1, n)*10 -5; y=polyval(P, x); plot(x, y, 'ro'); Produce a polynomial with zeros [-4, 0, 3] Plot the interpolating polynomial v=linspace(min(x), max(x)); z=int_poly(v, x, y); plot(v, z, 'k'); 數值方法 4
Demo_ip Source codes 數值方法 5
m=3, n=5 >> demo_ip data size n=5 數值方法 6
m=3, n=6 >> demo_ip data size n=6 數值方法 7
m=3, n=10 >> demo_ip data size n=10 數值方法 8
m=3, n=12 >> demo_ip data size n=12 數值方法 9
Sample with noise P=poly([-4 0 3]); n=6; x=rand(1, n)*10 -5; y=polyval(P, x); nois=rand(1, n)*0. 5 -0. 25; plot(x, y+nois, 'ro'); Produce a polynomial with zeros [-4, 0, 3] Plot the interpolating polynomial v=linspace(min(x), max(x)); z=int_poly(v, x, y+nois); plot(v, z, 'k'); 數值方法 10
Demo_ip_noisy source codes 數值方法 11
Noise data ► Noise ratio § Mean of abs(noise)/abs(signal) noise_ratio = 0. 0074 數值方法 12
Numerical results Small noise causes intolerant interpolation >> demo_ip_noisy data size n: 12 noise_ratio = 0. 0053 數值方法 13
Numerical results Small noise causes intolerant interpolation >> demo_ip_noisy data size n: 13 noise_ratio = 0. 0031 數值方法 14
Interpolation Vs approximation ► An interpolating polynomial is expected to satisfy all constraints posed by paired data ► An interpolating polynomial is unable to retrieve an original target function when noisy paired data are provided ► For noisy paired data, the goal of polynomial fitting is revised to minimize the mean square approximating error 數值方法 15
Polynomial approximation ► Given paired data, (xi, yi), i=1, …, n, the approximating polynomial is required to minimize the mean square error of approximating yi by f(xi) 數值方法 16
Polynomial fitting fa 1 d_polyfit. m 數值方法 17
Line fitting ► Minimizaing the mean square approximating error Target: 數值方法 18
Line fitting >> fa 1 d_polyfit input a function: x. ^2+cos(x) : x+5 keyin sample size: 300 polynomial degree: 1 Red: Approximating polynomial 8. 3252 e-004 E= a=1; b=5 數值方法 19
Line fitting >> fa 1 d_polyfit input a function: x. ^2+cos(x) : 3*x+1/2 keyin sample size: 30 polynomial degree: 1 E= 0. 0010 Red: Approximating polynomial a=3; b=1/2 數值方法 20
Objective function I ► Line fitting Target: 數值方法 21
► E 1 is a quadratic function of a and b ► Setting derivatives of E 1 to zero leads to a linear system 數值方法 22
a linear system 數值方法 23
Objective function II ► Quadratic polynomial fitting Target: 數值方法 27
► E 2 are quadratic ► Setting derivatives of E 2 to zero leads to a linear system 數值方法 28
a linear system 數值方法 29
Quadratic polynomial fitting ► Minimization of an approximating error Target: 數值方法 33
Quadratic poly fitting input a function: x. ^2+cos(x) : 3*x. ^2 -2*x+1 keyin sample size: 20 polynomial degree: 2 E= 6. 7774 e-004 a=3 b=-2 c=1 數值方法 34
Data driven polynomial approximation ► Minimization of Mean square error (mse) ► Data driven polynomial approximation § f : a polynomial pm § Polynomial degree m is less than data size n 數值方法 35
Special case: polynomial interpolation 數值方法 36
POLYFIT: Fit polynomial to data ► polyfit(x, y, m) § x : input vectors or predictors § y : desired outputs § m : degree of interpolating polynomial ► Use m to prevent from over-fitting ► Tolerance to noise 數值方法 37
POLYFIT: Fit polynomial to data P=poly([-4 0 3]); n=20; m=3; x=rand(1, 20)*10 -5; y=polyval(P, x); nois=rand(1, 20)*0. 5 -0. 25; plot(x, y+nois, 'ro'); A polynomial determined by zeros in [-4, 0, 3] Plot the interpolating polynomial v=linspace(min(x), max(x)); p=polyfit(x, y+nois, m); hold on; plot(v, polyval(p, v), 'k'); 數值方法 38
Non-polynomial ► sin fx=inline('sin(x)'); n=20; m=3 x=rand(1, n)*10 -5; y=fx(x); nois=rand(1, n)*0. 5 -0. 25; plot(x, y+nois, 'ro'); hold on 數值方法 39
Under-fitting m=3 v=linspace(min(x), max(x)); p=polyfit(x, y+nois, m); hold on; plot(v, polyval(p, v), 'k'); Under-fitting due to approximating nonpolynomial by low-degree polynomials 數值方法 40
Intolerant mse >> mean((polyval(p, x)-(y+nois)). ^2) ans = 0. 0898 Under-fitting causes intolerant mean square error 數值方法 41
Under-fitting m=4; v=linspace(min(x), max(x)); p=polyfit(x, y+nois, m); hold on; plot(v, polyval(p, v), 'b'); 數值方法 M=4 42
Fitting non-polynomial >> fa 1 d_polyfit input a function: x. ^2+cos(x) : sin(x) keyin sample size: 50 polynomial degree: 5 E= 0. 0365 數值方法 43
Fitting non-polynomial >> fa 1 d_polyfit input a function: x. ^2+cos(x) : tanh(x+2)+sech(x) keyin sample size: 30 polynomial degree: 5 E= 0. 0097 數值方法 44
- Spline interpolation vs polynomial interpolation
- Interpolation vs approximation
- Fully polynomial time approximation scheme
- Neville polynomial interpolation
- Polynomial interpolation
- 01:640:244 lecture notes - lecture 15: plat, idah, farad
- Steady state approximation example
- Importance of the study example
- Sample scope and limitation of the study
- Significance of the study example
- Scope and limitation study example
- Scope and limitation example
- Scope and limitation example
- Interpolation method
- Linear interpolation formula
- Cubic hermite interpolation
- Lagrange interpolation formula
- Newton forward interpolation formula is used for
- Parabolic interpolation formula
- Linear spline interpolation example
- Interpolation search worst case example
- Numpy.polynomial.polynomial
- How to divide a polynomial by another polynomial
- Variational shape approximation
- Numerical integration ppt
- Trapeziodal sum
- Taylor theorem
- Potentuial
- Transversality condition
- Site:slidetodoc.com
- Geoid shape
- Euler method formula
- Electrons in periodic lattices
- Cultural approximation
- Approximation de padé
- First approximation of diode
- Vogel's approximation method
- Normal approximation
- Linear approximation
- Linearization formula
- Pre equilibrium approximation
- First born approximation
- Alternating series error
- Vam stands for vogels approximation ___________________.
- Vazirani approximation algorithms