Question: use matlab 3. Question - Interpolation and surface plots. Write a script called randomSurface.m to do the following (1). To make a random surface, make

use matlab

3. Question-Interpolation and surface plots. Write a script called randomSurface.m to do the following

(1). To make a random surface, make Z0 a 5x5 matrix of random values on the range [0, 2] (use rand).

(2). Make an X0 and Y0 using meshgrid and the vector 1:5 (use the same vector for both inputs into

meshgrid). Now, X0, Y0, and Z0 define 100 points on a surface.

(3). We are going to interpolate intermediate values to make the surface seem smooth. Make X1 and Y1

using meshgrid and the vector 1:0.1:5 (again use the same vector for both inputs into meshgrid).

(4). Make Z1 by interpolating X0, Y0, and Z0 at the positions in X1 and Y1 using cubic interpolation (interp2,

specify cubic as the interpolation method).

Help of interp2.

(5). Plot a surface plot of Z1. Set the colormap to hsv and the shading property to interp (surf, colormap,

shading).

(6). Hold on to the axes and plot the 15-line contour on the same axes (contour).

(7). Add a colorbar (colorbar).

(8). Set the color axis to be from 0 to 1 (caxis). The final figure should look something like this

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!