Question: Ex 4 - 5 : Mesh and plot a surface,PS:this is a matlab code not python thank you Write a function named ex 4 p

Ex4-5: Mesh and plot a surface,PS:this is a matlab code not python thank you
Write a function named ex4p5. It received two vector variables and returns three matrices.
Write a subfunction that implements the "three-hump camel" function:
f(x,y)=2x2-1.05x4+x66+xy+y2
Write your subfunction in such a way that it accepts "vectorized" input (i.e. it computes function values elementwise
when x and y values).
Your main function receives to variables which contain the ranges of x and y, i.e.xmin,xmax and ymin,ymax.
Your main function returns as output values three 1010 matrices, which contain the x,y coordinate combinations
(use the "meshgrid" function, two first values) and the corresponding z=f(x,y) values (as the third function value).
Draw the function surface using the function "surf". Give your figure a title and label the axes. Note that the Moodle
interface does not display figures - use Matlab to see what you've drawn. (To see the "humps" you need more points
than ten points in each direction and probably also a logarithmic z-axis.)
(Food for thought - do not return: How you could change your function so that if one of the coordinate ranges would
be just a scalar, it would draw a 2D line? Or if both coordinate ranges were scalars, function would return just the
function value with the given pair of coordinates?)
 Ex4-5: Mesh and plot a surface,PS:this is a matlab code not

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!