Creating a mesh using vectors of x, y, and their corresponding z value

5 views (last 30 days)
Hello,
I'm trying to plot a 3D mesh of z values based upon x and y coordinates. I have tried doing this in a variety of ways, and have gotten a variety of errors - that z must be a matrix, not a vector or a scalar. Adjusting this so that x is a 1xn vector, y is a 1xn vector, and z is a 3xn matrix, where z(1,n) = x, z(2,n)=y, and z(3,n) is populated with the corresponding z values. Attempting to run: mesh(x, y, z,'EdgeColor','black'); I received the error that data dimensions must agree (not surprising). When I try to run: mesh(z); it plots an incorrect surface. For 10 iterations of my code, there are ten sets of 3 data points - it plots the x value, the y value, and the z value, along each of their respective axis', connecting the plotted points for each data point/matrix entry.
Any suggestions? Please let me know if you would like to see more of my code. Thanks!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!