How to plot a variable against two other dependent variables
Show older comments
Suppose I have a variable z = f(x,y). How can I generate a 2D plot with z along the vertical axis with x along the bottom horizontal axis and y along the top horizontal axis? Or I could have two bottom axis, one for x and one for y.
1 Comment
Azzi Abdelmalek
on 14 Sep 2012
I don't think it's possible, a 2D plot require only 2 values
Answers (1)
Sean de Wolski
on 14 Sep 2012
[xx yy] = meshgrid(x,y);
Z = f(xx,yy);
mesh(xx,yy,Z)
or
surf(xx,yy,Z);
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!