필터 지우기
필터 지우기

3D surface plot

조회 수: 2 (최근 30일)
Muhammad Choudhury
Muhammad Choudhury 2021년 11월 25일
답변: Dave B 2021년 11월 25일
This is my code so far, how i can i create a 3D surface plot just like the figure below:
X=[1.000, 1.250, 1.500, 1.250, 1.500, 1.750]';
Y=[1.000, 1.000, 1.000, 1.500, 1.500, 1.500]';
Z=[42.2, 42.6, 43.2, 42.1, 42.4, 43.1]';
figure
plot3(X,Y,Z,'mo')
grid on
xlabel('cold water flowrate')
ylabel('hot water flowrate')
zlabel('temperature')
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2021년 11월 25일
To create a surface place, your Z entry needs to be a matrix (atleast 2x2)

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

채택된 답변

Dave B
Dave B 2021년 11월 25일
You can interpolate using a scatteredInterpolant to make a matrix over the range of X and Y and then use surf to draw it, but I think you probably need more points to get a nice looking picture.
X=[1.000, 1.250, 1.500, 1.250, 1.500, 1.750]';
Y=[1.000, 1.000, 1.000, 1.500, 1.500, 1.500]';
Z=[42.2, 42.6, 43.2, 42.1, 42.4, 43.1]';
[xi,yi]=meshgrid(X,Y);
f=scatteredInterpolant(X,Y,Z);
zi=f(xi,yi);
surf(xi,yi,zi)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by