Professional Documents
Culture Documents
𝑓(𝑥2 ) = 𝑎𝑥2 2 + 𝑏𝑥2 + 𝑐 () The process will be like for x1, x2, and x3 find x4 and then based
on x2, x3, and x4 find x5, and keep doing the iteration over again
and again until you are close enough to the optimum.
𝑓(𝑥3 ) = 𝑎𝑥3 2 + 𝑏𝑥3 + 𝑐 ()
In this example, for the next iteration we will use the points
or, in matrix form. (2,8), (3,14) and the new point (-0.5,1.75) to solve the new
parabola as the pervious steps.
𝑥1 2 𝑥 1 𝑎 𝑓(𝑥1 ) In MATLAB, start solution with finding a, b, and c for
[𝑥2 2 𝑥 1] [𝑏 ] = [𝑓(𝑥2 )] () your first three points, after writing the matrix of your system
𝑥3 2 𝑥 1 𝑐 𝑓(𝑥3 ) find the inverse using inv function to find the inverse of
matrix, we obtain
Example: Determine the equation of the parabola that inv([0.5 -1 0.5; -2.5 4 -1.5; 3 -3 1])*[4;8;14]
passes throw the points (1,4), (2,8), and (3,14).
Solution: mathematically, write a system:
the solution is 𝑓(𝑥) = 𝑥 2 + 𝑥 + 2, and its associated plot is
𝑎+ 𝑏 + 𝑐=4 () shown below.
f=@(x) x.^2+x+2;
x=-4:0.01:4; similar to a parabola, Parabolic interpolation optimization is
x1=[-1 4 -3]; based on searching for an extreme point, 𝑥e , by fitting a
plot(x,f(x))
second-degree polynomial (parabola) to the function 𝑓(𝑥) over
But why not use Matlab to (symbolically) solve the a small interval that bounds 𝑥𝑒 . By selecting three points close
general formulation, to an extreme point (say, two that bound 𝑥𝑒 and a third internal
point), we may employ the method of parabolic interpolation
to approximate the shape of 𝑓(𝑥), and arrive at an estimate for
𝑎𝑥1 2 + 𝑏𝑥1 + 𝑐 − 𝑓(𝑥1 ) = 0 ()
𝑥𝑒 . The process can be repeated in order to improve the
estimate. The following example illustrates the application of
𝑎𝑥2 2 + 𝑏𝑥2 + 𝑐 − 𝑓(𝑥2 ) = 0 () the parabolic optimization method.
𝑎𝑥3 2 + 𝑏𝑥3 + 𝑐− 𝑓(𝑥3 ) = 0 () Example. Use parabolic interpolation to approximate the
minimum of the function 𝑓(𝑥) = 𝑥 2 ⁄10 − 2sin (𝑥) with
or the parabola coefficients and obtain in a script (interp2_mh) initial values x1=0, x2=1 and x3=4.
syms x x1 x2 x3 f1 f2 f3 a b c Solution. Substituting the initial 𝑥 values in the function
𝑓(𝑥) leads to (remember to set your calculator’s mode to
[a,b,c]=solve(a*x1^2+b*x1+c-f1,a*x2^2+b*x2+c- radians) the three interpolation points: (0, 0), (1, −1.5829) and
f2,a*x3^2+b*x3+c-f3,a,b,c) (4, 3.1136). Next, we use the interp2_mh script to compute the
a=(f1*x2-f2*x1-f1*x3+f3*x1+f2*x3-f3*x2)/((x1- parabola coefficients and the extreme point estimate:
x2)*(x1*x2-x1*x3-x2*x3+x3^2)) x=[0 1 4]; f=[0 -1.5829 3.1136];
b=-(f1*x2^2-f2*x1^2-f1*x3^2+f3*x1^2+f2*x3^2- format short
f3*x2^2)/((x1-x2)*(x1*x2-x1*x3-x2*x3+x3^2))
interp2_mh
c=-(-f3*x1^2*x2+ f2*x1^2*x3+ f3*x1*x2^2-f2*x1*x3^2-
f1*x2^2*x3+f1*x2*x3^2)/((x1-x2)*(x1*x2-x1*x3-
x2*x3+x3^2))
xe=(1/2)*((x2^2-x3^2*f1+x3^2-x1^2)*f2+(x1^2-
x2^2)*f3)/((x2-x3)*f1+(x3-x1)*f2+(x1-x2)*f3)
1 (𝑥2 − 𝑥3)2[𝑓(𝑥2) − 𝑓(𝑥1)] − (𝑥2 − 𝑥1)2 [𝑓(𝑥2) − 𝑓(𝑥3)] x=[0 1 1.5055]; f=[0,-1.5829 -1.7691];
𝑥𝑒 = 𝑥2 +
2 (𝑥2 − 𝑥1 )[𝑓(𝑥2) − 𝑓(𝑥3)] − (𝑥2 − 𝑥3)[𝑓(𝑥2) − 𝑓(𝑥1)] interp2_mh
()