plot a function in 3D
3 views (last 30 days)
Show older comments
I have variables a and b both defined in [-1,+1] and the function c = a / (a + b)
How can I plot c in 3D to visualize the function?
0 Comments
Accepted Answer
Walter Roberson
on 13 Aug 2011
RESOLUTION=20; %increase this for a finer grid
t = linspace(-1,1,RESOLUTION);
[a,b] = ndgrid(t,t);
c = a./(a+b);
surf(a,b,c);
It is, however, not possible to plot it as a continuous surface, as your graphics display only has discretized output locations ("pixels").
3 Comments
More Answers (1)
See Also
Categories
Find more on Line 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!