## Question

Part 1

Write a MATLAB script program that finds both the minimum and maximum of three dimensional functions using the Steepest Ascent Method. Your inputs should be the function and an x and y range from which you will choose multiple starting guesses. Your outputs should be the location of maxima and minima.

- First, create a matrix of at least four starting guesses based on the range

- Evaluate the partial derivatives numerically using the Central Difference Method (not analytically) to determine the direction of maximum gradient

- Use the Golden Search Method to evaluate the maximum of your 2D direction function

- Use the Hessian matrix to determine if youâ€™ve reach a local minimum or maximum.

- Your test script should also plot the locations of the minima and maxima on a 3D plot.

- To evaluate your program, use the function,

Fun=@(q,r) 1.8.^(-1.5*sqrt(q.^2+r.^2)).*cos(0.5*r).*sin(q);

Part 2

Write a MATLAB script program that calculates the Fast Fourier Transform using the Sande-Tukey Algorithm. Use only MATLAB math functions, ie +,-,cos,sin, and the functions imag and real to complete the algorithm in addition to standard logic/loop operators.

- The first part of the script should calculate the algorithm for the real and imaginary parts.

- The second part of the program should employ a bit reversal routine to unscramble the result Fourier coefficients.

- Validate your script with a problem of interest to your field, e.g. NMR, Seismic spectral analysis.

Guidelines for the report:

Each report should include three sections and a working m-file. You do not need to include the entire body of code in your written report, only in your m-file, but you may wish to reference parts of it in the report.

I. Theory and Background

a. A description of the assignment

b. A description of any applicable theory or background

II. Description of Code

a. A description of the content of your code and how it works

b. Discussion of any coding decisions made, i.e. choice of one type of logic

III. Results

a. Any numerical results that came from the code with a description of their importance and meaning

b. Any plots that were created

c. Conclusions

IV. Code (m-file)

a. Include a working m-file in your submission.

b. At the beginning of your script, include a comment with your name, date, assignment number, and a description of the assignment

c. Comment your code throughout the body of the code so that it is easy to understand if you come back to this code months later.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

function xmin=goldensection(f,a,b,tol)%approximates the minimum of the function f on the interval [a,b]

%using the golden search method with precision tol

%to find a maximum apply the function to -f

k=1; %number of loop counts

s=sqrt(5)/2-1/2; %s is approximately 0.618

a1=a+(1-s)*(b-a);

b1=a+s*(b-a);

fa1=f(a1);

fb1=f(b1);

while (b-a>tol)

if fa1>fb1

a=a1;

a1=b1;

fa1=fb1;

b1=a+s*(b-a);

fb1=f(b1);

else

b=b1;

b1=a1;

fb1=fa1;

a1=a+(1-s)*(b-a);

fa1=f(a1);

end

k=k+1;

end

xmin=a;

end...

By purchasing this solution you'll be able to access the following files:

Solution.zip.