Creating a surface from 3 vectors

6 ビュー (過去 30 日間)
Adam Null
Adam Null 2016 年 4 月 23 日
コメント済み: Adam Null 2016 年 4 月 23 日
I have this data.csv file which contains 3 columns. Now, what I am trying to do is create a 3D model which should look something like this.
I went through couple of posts which I found here and tried to create this model in Matlab but it went wrong. This is what I get.
Here is the code, which I used to create those models. close all; clear all;
X=xlsread('data.csv', '', 'A:A');
Y=xlsread('data.csv', '', 'B:B');
Z=xlsread('data.csv', '', 'C:C');
[XI YI ZI] = griddata(X,Y,Z,linspace(0,1),linspace(0,1)');
figure
subplot(1,2,1)
trisurf(delaunay(X,Y),X,Y,Z)
subplot(1,2,2);
surf(XI,YI,ZI)
The problem is probably that I have more z-values for a certain x-y pair. How can I fix it in order to get a model just like the one above?

回答 (1 件)

Star Strider
Star Strider 2016 年 4 月 23 日
You seem to have the correct idea but not the correct functions. See the documentation on Volume Visualisation and Polygons. One of these may do what you want.
My experience with them is limited and not recent, so you may have to experiment on your own with them and with your data.
  1 件のコメント
Adam Null
Adam Null 2016 年 4 月 23 日
I went through the volume visualisation documentation a couple of times before I posted my question. I tried to use those functions but I can't get it right.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by