Using surf for plotting function
Show older comments
I have a function f(i,j). How to plot a 3D graph (like surf) for f(i,j) vs x(i) vs y(j) ?
I have to plot it against two different variables x and y . f is not a direct function of x and y.
For example: Take f(i,j) = i*j [ for i=1:4,j=1:3 ]
x = [5,6,7,10]; y=[2,-3,4]; Now I have to plot f(i,j) vs x(i) vs y(j)
Answers (1)
Image Analyst
on 12 May 2014
Do you mean like this:
x = [5,6,7,10];
y=[2,-3,4];
[X, Y] = meshgrid(x,y);
f = X .* Y
surf(f);
Categories
Find more on Lighting, Transparency, and Shading 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!