# how to plot surface graph in matlab?

조회 수: 2 (최근 30일)
Deepesh Kumar Gupta 2022년 4월 9일
댓글: Deepesh Kumar Gupta 2022년 4월 11일
I have 41 values of temperature starting from 350,351,352,353...........,390 and 30 values of radius starting from 0.001, 0.002, 0.003......,upto 0.03.Now from 41 values of temperature and 30 values of radius , i obtained 41*30 =1230 values of PPDF. Now i have to plot surface graph between Temperature (let's on x co-ordinate ), radius (let's on y co-ordinate) and PPDF (on z co-ordinate ). How can i plot surface graph ? please help me with the code. Here i am attaching my code which is giving me error.
% x co-ordinate data
temp1=350:1:390;
temp=temp1';
% y co-ordinate data
% z co-ordinate data
% for this i have attached csv file.
% here 'temp_rad_graph _data.csv is the file which consist x ,y and z coordinate data
x=test(:,1);
y=test(:,2);
z=test(:,3);
h=scatter3(x,y,z,'filled','MarkerEdgeColor','flat')
colormap jet

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

### 채택된 답변

Scott MacKenzie 2022년 4월 9일
편집: Scott MacKenzie 2022년 4월 9일
The surf function is probably what you want: (Note that csvread is "not recommended".)
x = 350:390;
y = linspace(0.001, 0.03, 30);
z = reshape(z, numel(y),[]);
surf(x, y, z, 'FaceColor', [.7 .8 .9]);
xlabel('Temperature');
zlabel('PPDF');
##### 댓글 수: 3이전 댓글 1개 표시이전 댓글 1개 숨기기
Scott MacKenzie 2022년 4월 10일
@Deepesh Kumar Gupta, you're welcome. Glad to help. Good luck.
Deepesh Kumar Gupta 2022년 4월 11일
@Scott MacKenzie, can you help me to plot these data by scatter3 ploting?
I am trying to do with this following code , also i am attaching one graph for reference.
% x co-ordinate data
temp1=350:1:390;
temp=temp1';
% y co-ordinate data
% z co-ordinate data
% for this i have attached csv file at starting of discussion.
% here 'temp_rad_graph _data.csv is the file which consist x ,y and z coordinate data
x=test(:,1);
y=test(:,2);
z=test(:,3);
h=scatter3(x,y,z,'filled','MarkerEdgeColor','flat')
colormap jet

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

### 카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by