Using surf for plotting function

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)

답변 (1개)

Image Analyst
Image Analyst 2014년 5월 12일

0 개 추천

Do you mean like this:
x = [5,6,7,10];
y=[2,-3,4];
[X, Y] = meshgrid(x,y);
f = X .* Y
surf(f);

댓글 수: 1

chaos
chaos 2014년 5월 13일
No, f=1,2,3,4,5,6,7,8,9,10,11,12. I wanted to plot f vs x vs y

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2014년 5월 12일

댓글:

2014년 5월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by