Surface fit of a 3d scatter plot

I have a m x 3 matrix, where the first column is the x coordinate, second is y, and third is z. I managed to create a 3D scatter plot using this data, but I can't get Matlab to draw a mesh surface that goes between the points. The relationships between the points are not mathematically controlled (they come from a biological assay), so the surface fitting would have to follow some sort of moving average or such. Is there anything out there that can do it for me?
Thanks in advance.

回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 7 月 12 日

2 投票

doc griddata
No, more like:
x = your_matrix(:,1);
y = your_matrix(:,2);
z = your_matrix(:,3);
[xgrid ygrid] = meshgrid(1:5,1:10); %sample x and y ranges
z2 = griddata(x,y,z,xgrid(:),ygrid(:));
z2 = reshape(z2,size(xgrid));
You can also use TriScatteredInterp, though I haven't become a fan of it yet.

1 件のコメント

Matt Severson
Matt Severson 2016 年 4 月 14 日
Unless I'm misunderstanding the intentions, this is overly complicated. meshgrid will take an x and y vector as arguments and construct the grid from there.
[xgrid, ygrid] = meshgrid(x,y)
There's no need for the extra manipulation.

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

Hans
Hans 2011 年 7 月 12 日

0 投票

Thanks.
You sure that works for my m x 3 matrix? Or should I convert it to something else first? Right now it's like this
[x y z; x1 y1 z1; x2 y2 z2;.... etc]

カテゴリ

ヘルプ センター および File ExchangePolar Plots についてさらに検索

質問済み:

2011 年 7 月 12 日

コメント済み:

2016 年 4 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by