I"ve never used the surf function before and I am getting this error that I do not understand. I"ve read the other posts on this and still can"t figure out what I need to do.
What can"t I just do = meshgrid(xA,yA) then surf(x,y,zA)? I don"t see what other info the function would need to make a surface. Can someone tell me how to get this working?



A surface is a 3D plot. All your X values are repeated for every Y value, and vice versa, meaning the surface is 5001 x 5001. Surf automatically can handle a vector for X and Y, but Z must be the matrix containing the Z value for every combination of X and Y.

You are watching: Z must be a matrix, not a scalar or vector.



Thank you very much for the info Cris and Walter. I needed that background info to understand how MATLAB works it versus how I think about it. I see the missing link, I"ll do some more research to get a more solid understanding. Much appreciated!


Walter: That"s why I said to use scatter3. This allows you to view the data first to see if it even could create a surface, or if it is just a line. It is possible to record all the points for a surface in a vector. If the result does end up looking like it could be a surface, then you might be able to just reshape the vectors into matrices that can be plotted using surf.

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Select a WebSite

Choose a web site to get translated content where available and see local events andoffers. Based onyour location, we recommend that you select: .

See more: Resident Evil 2 Remake Speedrun Guide S, Resident Evil 2 Remake

Select web site

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other hyakkendana-hashigozake.com countrysites are not optimized for visits from your location.