I need to plot a surface plot from given X and Y coordinate matrixes and z as a constant value.
2 views (last 30 days)
Show older comments
My matrices are X= [0 1;2 3]; and Y = [0,1; 2 3]; Now I need to plot each value of X with every value of y with a z value of 0 i.e. x=0, y=0,z=0 ; x=0,y=1,z=0; x=0,y=2,z=0; x=1,y=0,z=0;and so on. How do I do this?
0 Comments
Accepted Answer
Guillaume
on 28 Jun 2018
Why do your X and Y have two columns if it means nothing?
X = 0:3;
Y = 0:3;
Z = 0;
[XX, YY] = ndgrid(X, Y);
surf(XX, YY, repmat(Z, size(XX)));
3 Comments
Walter Roberson
on 28 Jun 2018
Instead of repmat you can use
surf(XX, YY, Z * ones(size(XX)))
More Answers (0)
See Also
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!