Reputation: 97581
I have this code, which takes a meshgrid, and applies a transformation to every point:
function [newx, newy] = transform(x, y)
newx = 10 * x + y*y;
newy = 5 * y;
end
[x, y] = meshgrid(1:5, 1:5);
[u, v] = arrayfun(@transform, x, y);
I want to plot the new mesh in 2D. The closest I can get is to do so in 3D by adding a Z component of 0:
mesh(u, v, zeros(size(u)))
How can I get matlab/octave to just show this plot on a 2d set of axes?
Upvotes: 5
Views: 13895
Reputation: 13876
Maybe I'm missing the point here, but what's wrong with a simple plot(u,v,'b-x',u',v','b-x')
?
Upvotes: 6