AERO2598 Matlab Assignment 1-2 Slides
AERO2598 Matlab Assignment 1-2 Slides
(AERO2598)
Assignment 1.2: Matlab Functions - Surface
Derivatives and Plotting
Co-ordinator: Dr Yidan Shang
Room 251.3.57
School of Engineering
Bundoora East Campus
Email: [email protected]
Submission Instructions
• You will be provided with two MATLAB files:
Main_Test_Script_surface_derivative.m
(You should not submit this file. This is the main script you will use to test
your function)
LastName_StudentID_surface_derivative.m
(Submit this file named with your last name and student ID. Make sure to
also modify the function name within the scripts)
RMITUniversity AERO2598 2
Assignment objectives
We consider a 2 variables function z=f(x,y). The general objectives are as follow:
• To evaluate this function over a range of x and y values, to display the output as a 3D
plot and find Maximum and Minimum values.
• To evaluate the partial derivative డൗడ௫ and డൗడ௬ over the same range of x and y
values and to display the output, together with Maximum and Minimum values.
RMITUniversity AERO2598 3
Assignment Tasks
1. Create a Matlab function which displays a surface plot for a given mathematical
function defined as an anonymous function.
2. Determine the partial derivative using numerical methods (not symbolical) and
plot the results in a 3 dimensional graph.
3. Correctly label any charts and graphs (axes labels, titles, etc.)
4. Determine and display on your graphs the location of the maximum/minimum values
by using a marker.
5. Provide the coordinates of the maximum and minimum values to the user as
three arrays.
RMITUniversity AERO2598 4
MainScript
Program Flow
Declarevariables
Defineananonymousfunction
Command
Window
Displayedoutput
RMITUniversity AERO2598 5
IMPORTANT!!–Donotredefinetheinput/outputterms.
RMITUniversity AERO2598 6
Function Output Arguments
[minmax1Z,minmaxDX,minmaxDY]=
LastName_StudentID_surface_derivative(xlims,ylims,nx,ny,myfun)
Firstrow:xandypositionoftheminimumofthefunction’s
partialderivativewithrespecttox.
minmaxDX 2×2matrix
Secondrow:xandypositionofthemaximumofthefunction’s
partialderivativewithrespecttox.
Firstrow:xandypositionoftheminimumofthefunction’s
partialderivativewithrespecttoy.
minmaxDY 2×2matrix Secondrow:xandypositionofthemaximumofthefunction’s
partialderivativewithrespecttoy.
NOTE:Iftherearemultipleminima/maxima,youonlyneedtofindandreturnthecoͲordinates ofone.
7
RMITUniversity AERO2598
• Evaluate NUMERICALLY a partial derivative using the following equation, where ߲ݔ
is a small number.
డ ௫ǡ௬ డ ௫ାఋ௫ǡ௬ ିሺ௫ǡ௬ሻ
ൎ ൌ
డ௫ డ௫ ఋ௫
• You MUST use and manipulate arrays instead of for and while loops.
RMITUniversity AERO2598 9
Marking Guidelines
RMITUniversity AERO2598 10