plot 2 variables of different length
조회 수: 2 (최근 30일)
이전 댓글 표시
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
2021년 7월 4일
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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/674293/image.png)
댓글 수: 7
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!