how to plot 3D graph using mesh() for a rectangular matrix of data?
Show older comments
Dear sir/madam,
I am using mesh() to plot 3D graphs. To plot a 3D graph the length of x-axis and y-axis must be equal, using mesh(). But I need to plot a 3D graph where the length of x-axis and y-axis are not equal. When I tried to plot the graph for unequal lengths, it showed "dimensions do not agree". How can I plot a 3D graph for unequal lengths, using mesh()? Looking forward for your reply.
Thanking you, BSD
Accepted Answer
More Answers (1)
Andrei Bobrov
on 20 Jul 2011
[X,Y] = meshgrid(x,y);
Z = fun(X,Y);% or Z - array double with size [length(x),length(y)]
mesh(X,Y,Z)
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!