Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with a matlab problem. THX! The function is somewhat whimsically known as Rosenbrock's banana function. It is often used as a benchmarking test

Need help with a matlab problem. THX!

image text in transcribed

image text in transcribed

image text in transcribed

The function is somewhat whimsically known as Rosenbrock's banana function. It is often used as a benchmarking test for optimization algorithms because it is easy to find the minimum analytically but often very tricky numerically. In this problem we will explore a method called gradient descent to find this minimum. Throughout the problem, we will use the values a = 1 and b= 10. You can plot this function using the following code y -10:0.2:10; (X, Y] meshgrid(x, y); surf(X, Y, z) (a) Write a Matlab function that computes f using only one input. (That is, your function should only use one variable.) Use this function to calculate f(-1,8) and save the result in A1.dat (b) Use fminsearch to find the minimum of f and save it as a 2 1 vector [XI; in the file A2.dat. Use an initial guess of [-l; 8 Things to think about: Can you confirm the minimum of f analytically? This should be easy.) Try timing fminsearch. How long does it take to find this minimum? c) Find a formula for the gradient ( T2). Recall from calculus that the gradient is defined as the 2 1 vector T1, T2 T1, T2 1, 2) Calculate f(-1.8) and save the resulting 2 1 vector in A3. dat. The function is somewhat whimsically known as Rosenbrock's banana function. It is often used as a benchmarking test for optimization algorithms because it is easy to find the minimum analytically but often very tricky numerically. In this problem we will explore a method called gradient descent to find this minimum. Throughout the problem, we will use the values a = 1 and b= 10. You can plot this function using the following code y -10:0.2:10; (X, Y] meshgrid(x, y); surf(X, Y, z) (a) Write a Matlab function that computes f using only one input. (That is, your function should only use one variable.) Use this function to calculate f(-1,8) and save the result in A1.dat (b) Use fminsearch to find the minimum of f and save it as a 2 1 vector [XI; in the file A2.dat. Use an initial guess of [-l; 8 Things to think about: Can you confirm the minimum of f analytically? This should be easy.) Try timing fminsearch. How long does it take to find this minimum? c) Find a formula for the gradient ( T2). Recall from calculus that the gradient is defined as the 2 1 vector T1, T2 T1, T2 1, 2) Calculate f(-1.8) and save the resulting 2 1 vector in A3. dat

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions