X Y Z Surface Plot Problem

조회 수: 3 (최근 30일)
Bora Tek
Bora Tek 2012년 4월 20일
Hello Friends,
I need your assistance about plotting x y z axis surface graphic
I have tunnel data on excel; Tunnel lenght, Temperature, Time
I want to show these datas on matlab
here is my datas
Thank you so much

채택된 답변

Matt Tearle
Matt Tearle 2012년 4월 20일
data = xlsread('filename.xlsx'); % read in everything (numeric)
t = data(1,2:end); % first row (except first element)
l = data(2:end,1); % first column (except first element)
temp = data(2:end,2:end); % actual data in the table
surf(t,l,temp) % make surface plot
  댓글 수: 2
Bora Tek
Bora Tek 2012년 4월 20일
Thank you so much Matt Tearle :)
I'm a rookie on matlab by the way :)
Matt Tearle
Matt Tearle 2012년 4월 20일
Welcome. No problem, we all start somewhere :)
http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab

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

추가 답변 (2개)

Bora Tek
Bora Tek 2012년 4월 20일
Thank you so much for your help Matt, This link will help me im sure :) I have one more question, can i change x axis position with y axis? if i can do that, do i have to change my excel data? i want to show my datas like this.
Thank you
  댓글 수: 1
Matt Tearle
Matt Tearle 2012년 4월 23일
You mean exchange the x and y axes? Yes, just transpose your data matrix:
temp = data(2:end,2:end)';
surf(l,t,temp)

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


Bora Tek
Bora Tek 2012년 4월 29일
Hi Matt,
I changed the code as you said;
data = xlsread('sıcaklık100mw.xlsx');
t = data(1,2:end);
l = data(2:end,1);
temp = data(2:end,2:end);
surf(l,t,temp)
But i got this error message:
Error using surf (line 75)
Data dimensions must agree.
  댓글 수: 1
Matt Tearle
Matt Tearle 2012년 4월 30일
Note the transpose operator (') at the end of the command temp = data(2:end...
temp is a matrix with m rows and n columns. When making a surface plot, the m rows are taken to be the values at m y locations; the n columns are taken to be the values at n x locations. So when you do surf(x,y,temp), the x vector should have n elements, and y should have m elements. To switch x and y, you need to flip (transpose) the matrix *and* the x and y vectors in the surf command.

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

카테고리

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