Surf Plot error code with Z having to be defined as a matrix, not scalar or vector
Show older comments
I'm trying to graph a 3D function z=(x-y)/(1+y) as a challenge.
Here is what I have so far:
>> x=-1:1:1;
>> y=-1:1:1;
>> [X,Y]=meshgrid(x,y);
>> Z=[(x-y)/(1+y)];
>> surf(X,Y,Z)
It is returning:
Error using surf (line 71)
Z must be a matrix, not a scalar or vector.
I do not know what the problem is with my code, can someone help? Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!