Question
given values are correct. only need missing values.
(1 point) Starting with a--1, b = 1, do 4 iterations of golden section search to estimate wheref(x)-(x2-sin(4 * x)) reaches a
1 0
Add a comment Improve this question Transcribed image text
Answer #1

SOLUTION

i-value a b c d f(c) f(d)
0 -1 1 -0.2361 0.23607 0.8658 -0.75434
1 -0.2361 1 0.23607 0.52786 -0.75434 -0.57873
2 -0.2361 0.52786 0.05573 0.23607 -0.21797 -0.75434
3 0.05573 0.52786 0.23607 0.34752 -0.75434 -0.86295
4 0.23607 0.52786 0.34752 0.41641 -0.86295 -0.82211

============================================================================

Matlab Code: Create a new file f.m with the following code

function y=f(x)

y=x^2-sin(4*x);

Now do the following in the matlab terminal.

figure; hold on;

a=-1; % start of interval

b=1; % end of interval

epsilon=0.000001; % accuracy value

iter= 5; % maximum number of iterations

tau=double((sqrt(5)-1)/2); % golden proportion coefficient, around 0.618

k=0; % number of iterations

x1=a+(1-tau)*(b-a); % computing x values

x2=a+tau*(b-a);

f_x1=f(x1); % computing values in x points

f_x2=f(x2);

plot(x1,f_x1,'rx') % plotting x

plot(x2,f_x2,'rx')

while ((abs(b-a)>epsilon) && (k<iter))

k=k+1;

if(f_x1<f_x2)

b=x2

x2=x1

x1=a+(1-tau)*(b-a)

  

f_x1=f(x1)

f_x2=f(x2)

  

plot(x1,f_x1,'rx')

else

a=x1

x1=x2

x2=a+tau*(b-a)

  

f_x1=f(x1)

f_x2=f(x2)

plot(x2,f_x2,'rx')

end

end

Add a comment
Know the answer?
Add Answer to:
given values are correct. only need missing values. (1 point) Starting with a--1, b = 1, do 4 iterations of golden section search to estimate wheref(x)-(x2-sin(4 * x)) reaches a minimum. f(c) f(d)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT