Create a surface with separate contours from other plots

2 ビュー (過去 30 日間)
Indira
Indira 2022 年 6 月 13 日
コメント済み: Bjorn Gustavsson 2022 年 6 月 13 日
I saved one contour from separate surfaces as a matrix of 3xn (each column is x, y and z (elevation)).
I use plot3 for each contour into a new plot window. I wonder if I can obtain a full surface from those contours.
plot3(CContour_13MW(:,1),CContour_13MW(:,2),CContour_13MW(:,3),'-o')
hold on;
plot3(CContour_14MW(:,1),CContour_14MW(:,2),CContour_14MW(:,3),'-o')
Note:
1) Contours have different length from each other (e.g., contour1 is 3x15, contour2 is 3x23, contour3 is 3x29).
2) I has this error when I tried to use interp1: Sample points must be unique and sorted in ascending order.
Thanks in advance.
  2 件のコメント
John D'Errico
John D'Errico 2022 年 6 月 13 日
Note that interp1 would have been useless, because interp1 is for a problem with only one independent variable. You have both x and y.
interp2 would be useless, because this is a scattered data interpolation problem. That is not what interp2 does, and you cannot force it to do that.
So you need to do as @Bjorn Gustavsson says, and use tools like scatteredInterpolant.
Note that you MAY still have some issues around the edges of the surface, as it is difficult to see if the data represents a convex domain in (x,y).
Without any data posted, I won't go any further, nor will I post an answer to suggest alternatives, and possible ways you might resolve any problems around the perimeter.
Indira
Indira 2022 年 6 月 13 日
Thanks for your comments, John.
I added some data to the question for further assistance. In the meantime, I will have a look on the scatteredInterpolant.
Thanks again!

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

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2022 年 6 月 13 日
Just concatenate all your n-by-3 data into a large many-by-3 array and then check up the help and documentation of scatteredInterpolant. That function will do a triangulation-based interpolation on your data.
HTH
  4 件のコメント
Indira
Indira 2022 年 6 月 13 日
You are the best!
It is exactly what I wanted! Many thanks!
Bjorn Gustavsson
Bjorn Gustavsson 2022 年 6 月 13 日
Thank you and happy that it helped.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by