Question

In MATLAB, generate a 3D plot as follows: Create 2 vectors x and y, both ranging...

  1. In MATLAB, generate a 3D plot as follows:
  1. Create 2 vectors x and y, both ranging from -5 to 5 with interval of 0.05 using linspace or colon operator.

  1. Generate grid of values X and Y using the vectors x and y.

  1. Define the variable Z as follows:

Z = 2X3 + 4Y2 + 7 +sinX3 + Y2

  1. Generate a surface and a mesh plot with the variables X,Y,Z. Show your plots.

Homework Answers

Answer #1

clc;

x = -5:0.05:5;

y = -5:0.05:5;

[X, Y] = meshgrid(x, y);

Z = 2*X.^3 + 4*Y.^2 + 7*sin(x).^3 + Y.^2;

figure()

surf(X,Y,Z)

figure()

mesh(X,Y,Z)

%surfplot

%meshplot

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using MATLAB, Obtain the plot of z = sinr where r = sqrt (x2 +y2) over...
Using MATLAB, Obtain the plot of z = sinr where r = sqrt (x2 +y2) over the domain (−20<x,y<20). In order to define your domain, you may start with xd=-20:40/99:20; yd = xd; [x,y] = meshgrid(xd,yd);. Then you might first compute r= sqrt(x.^2+y.^2); z= sin(r)./r;. Following this, issue the command plot3(x,y,z,’k’) to get the 3-D plot of this surface. Here ’k’ makes it black. Next instead of plot3(x,y,z,’k’) you can try mesh(x,y,z); colormap([1,0,0]) to get a red mesh plot. You...
Write a MATLAB m file to plot the 3-D curve represented by a multivariable function z(x,y)...
Write a MATLAB m file to plot the 3-D curve represented by a multivariable function z(x,y) = x2 −0.5y2 over x ∈ [−2,2] and y ∈ [−2,2]. Use a 2 point thickness. For both x an y axes, choose the grid size to be 0.05. Clearly label and title your plot. Rotate the view at an azymuth of −20 , and elevation of 20 . You need to use the following commands: x=-2:0.05:2; y=x; z=x.^2-0.5*y.^2; plot3(x,y,z,’LineWidth’,2) label(’ My 3D curve’);...
Q) a) create a matrix named as X of evenly spaced values from 0 to 50,...
Q) a) create a matrix named as X of evenly spaced values from 0 to 50, with an increment of 10. b) a) create a matrix named as Y of evenly spaced values from 500 to 1000, with an increment of 3. c)a) create a matrix named as Z, the value of the 1st row is from 1 to 10, 2nd row from 2 to 20 with increment of 2, 3rd row 3 to 12. using subplot divide the window...
Use Matlab to solve the following (a) Create a plot with a sphere at the center...
Use Matlab to solve the following (a) Create a plot with a sphere at the center of the graph (origin) representing the sun with a radius of 6955000 km. Make sure that the outside of the sphere is painted in ’autumn’ colors. (Hint: look up the sphere() function, the colormap() function, and the surf() function). (b) Create a variable t ranging from 0 to 2? with increments of 0.01. (c) The following Table gives you important values needed to compute...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT