x = 100:400 ;
y = 600:1500 ;
Z = 3*x+2*y ;
I want to plot z (along z axis) as a function of x (along x axis) and y (along y axis).

 채택된 답변

Image Analyst
Image Analyst 2021년 7월 4일

0 개 추천

Try meshgrid():
x = 100:400 ;
y = 600:1500 ;
[X, Y] = meshgrid(x, y);
Z = 3 * X + 2 * Y;
surf(X, Y, Z, 'EdgeColor', 'none');
fontSize = 15;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
title('Z = 3 * X + 2 * Y', 'FontSize', fontSize);
colormap(jet(256));
colorbar;

댓글 수: 7

priya
priya 2021년 7월 4일
thank you
priya
priya 2021년 7월 4일
For the above case, if i need to plot a function,
P=X/Z;
what should be the command?
x = 100:400 ;
y = 600:1500 ;
[X, Y] = meshgrid(x, y);
Z = 3 * X + 2 * Y;
subplot(1, 2, 1);
surf(X, Y, Z, 'EdgeColor', 'none');
fontSize = 15;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
title('Z = 3 * X + 2 * Y', 'FontSize', fontSize);
colormap(jet(256));
colorbar;
P = X ./ Z;
subplot(1, 2, 2);
imshow(P, [], 'XData', x, 'YData', y);
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
axis('on', 'xy');
title('P = X ./ Z', 'FontSize', fontSize);
colorbar;
impixelinfo;
g = gcf;
g.WindowState = 'maximized'
priya
priya 2021년 7월 5일
In this figure, how can i plot the minimum value of Z on the X axis, for every value of Y?
minYValues = min(Z, [], 2);
minXValues = min(Z, [], 1);
priya
priya 2021년 7월 5일
How to plot minYValues on the surface plot?
Image Analyst
Image Analyst 2021년 7월 5일
I show you the image on the right. Can you show me exactly what you'd expect your surface plot to look like if I did what you are asking?

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

추가 답변 (0개)

카테고리

제품

릴리스

R2017a

질문:

2021년 7월 4일

댓글:

2021년 7월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by