Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MATLAB function to implement the parabolic interpolation method for finding a local optimum of any one-dimensional function. The overall structure of the M-function

image text in transcribed

image text in transcribed

Write a MATLAB function to implement the parabolic interpolation method for finding a local optimum of any one-dimensional function. The overall structure of the M-function can be taken to be similar to that for the golden-section search function discussed in class (see also "goldmin.m" posted on Canvas under Lecture 8), with the following major differences: (i) The parabolic interpolation method requires three initial guesses X1 , X2 and 3, based on which a new value 4 for the optimum location is determined from Equation (7.10) in the textbook, which is obtained from a parabolic fit. (ii) a strategy is required to determine three new guesses (brackets) x1 , x2 and x3 for the subsequent iteration by discarding one of the points above. These two aspects can be incorporated in your M-function by modifying the following pieces of a code function [x,fx,ea,iter] parainterpmin(f,x1,x2,x3,es,maxit,varargin) % fill in the details here, such as comments and setting default values, % similar to that in the "goldmin.m" discussed in class-Lecture 8 iter-0; % initialize iteration index x1 new-x1; x2new-x2; x3new-x3; 96 set additional copies of initial brackets (guesses) x4-x3; % set new point as intermediate point while(1) x1 : x1new, x2 : x2new; x3-x3new; % start with new bracket for each iteration x4old-x4; % set previous iteration optimum value (x4) to x4old % parabolic interpolation formula to locate optimum, i.e. min, with bracket (x1,x2,x3) % write formula given in Equation (7.10) in the textbook x4x2-1/2*( ((x2-x1)A2)*(f(x2)-f(x3))-((x2-x3)A2)*(f(x2)-f(x1)) )/... ((x2-x1)*(f(x2)-f(x3)-(x2-x3)((x2)-f(x1)) ); % strategy to discard a point and determine new brackets if x4 > x2 % new point to the right of intermediate point if f(x4,varargin(:)) > f(x2,varargin(:)) 96 new brackets (x1,x2,x4) x1new x1; x2new x2; x3new x4; else % new brackets (x2,x4,x3) x1new x2; x2new x4; x3new x3; Write a MATLAB function to implement the parabolic interpolation method for finding a local optimum of any one-dimensional function. The overall structure of the M-function can be taken to be similar to that for the golden-section search function discussed in class (see also "goldmin.m" posted on Canvas under Lecture 8), with the following major differences: (i) The parabolic interpolation method requires three initial guesses X1 , X2 and 3, based on which a new value 4 for the optimum location is determined from Equation (7.10) in the textbook, which is obtained from a parabolic fit. (ii) a strategy is required to determine three new guesses (brackets) x1 , x2 and x3 for the subsequent iteration by discarding one of the points above. These two aspects can be incorporated in your M-function by modifying the following pieces of a code function [x,fx,ea,iter] parainterpmin(f,x1,x2,x3,es,maxit,varargin) % fill in the details here, such as comments and setting default values, % similar to that in the "goldmin.m" discussed in class-Lecture 8 iter-0; % initialize iteration index x1 new-x1; x2new-x2; x3new-x3; 96 set additional copies of initial brackets (guesses) x4-x3; % set new point as intermediate point while(1) x1 : x1new, x2 : x2new; x3-x3new; % start with new bracket for each iteration x4old-x4; % set previous iteration optimum value (x4) to x4old % parabolic interpolation formula to locate optimum, i.e. min, with bracket (x1,x2,x3) % write formula given in Equation (7.10) in the textbook x4x2-1/2*( ((x2-x1)A2)*(f(x2)-f(x3))-((x2-x3)A2)*(f(x2)-f(x1)) )/... ((x2-x1)*(f(x2)-f(x3)-(x2-x3)((x2)-f(x1)) ); % strategy to discard a point and determine new brackets if x4 > x2 % new point to the right of intermediate point if f(x4,varargin(:)) > f(x2,varargin(:)) 96 new brackets (x1,x2,x4) x1new x1; x2new x2; x3new x4; else % new brackets (x2,x4,x3) x1new x2; x2new x4; x3new x3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago