# import data and plat a 3D

조회 수: 3(최근 30일)
Verena Salan 20 Dec 2019
댓글: Rik 6 Jan 2020
I do have a excel file with 3 columns (x y z). I wanna import them to Matlab, and plot a nice surface Plot.i might have to interpolate?

#### 댓글 수: 2

Rik 20 Dec 2019
If it is a full grid of x and y, there will be no need for interpollation. Can you share your actual data, or a functional equivalent?
Verena Salan 20 Dec 2019
here are my data

로그인 to comment.

### 답변(2개)

Rik 20 Dec 2019
No interpollation required, just a conversion to a 2D matrix. You can adapt the syntax of accumarray if you do have any missing values (by default it will fill with 0).
x=num(:,1);
y=num(:,2);
P=num(:,3);
%find the unique x and y values and use them as indices to fill the Z
[X,~,x_]=unique(x);
[Y,~,y_]=unique(y);
Z=accumarray([x_,y_],P);
[X,Y]=ndgrid(X,Y);
surf(X,Y,Z)

#### 댓글 수: 10

표시 이전 댓글 수: 7
Rik 6 Jan 2020
What have you tried so far?
Verena Salan 6 Jan 2020
don't know how
Rik 6 Jan 2020
On a conceptual level, what would you do? If you needed to do it on paper, what would your approach be?

로그인 to comment.

ME 20 Dec 2019
I think you are correct about the need to interpolate. You could try having a read of the link below - that should give you some good pointers.

#### 댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by