surf plot from data sets connected to each other

I have a data (the file "data.mat" in attachment), that has a connected ribbons „structure”. I want to make a meshgrid and then a surface plot from the data, in a "circle way" seen on the picture below. When I tried to do this, I got an error informing that I am trying to use memory resources equivalent to billions of data.
Here is the code, I did for plotting using plot3() function.
data1=flip(data);
r=data1{:,'Yposition'};
t=data1{:,'Angle'};
z=data1{:,'MagZ'};
x=(2*pi*t)/360;
%first element of the vector
p=r(length(r),1)-2;
%last element of the vector
o=r(1,1);
%the number of radii
N=((o-p)/2)+1;
%amount of data for one circumference
k=floor(length(r)/N);
%plotting loop
figure
hold on
grid on
for i=1:(N-1);
j=(((i-1)*(k))+1):((i)*(k));
plot3((i)*cos(x(j)),(i)*sin(x(j)),z(j))
end
I ask You for help, because I have spent days on solving the problem and still don't know how to do this. :(

 採用された回答

Chunru
Chunru 2022 年 9 月 3 日

0 投票

load(websave("data.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1115735/data.mat"))
head(data)
ans = 8×3 table
Yposition Zposition Angle _________ _________ ______ 128 80 232.51 128 80 232.45 128 80 232.67 128 80 232.54 128 80 232.38 128 80 232.47 128 80 232.49 128 80 232.49
data1=flip(data);
r=data1.Yposition;
t=data1.Angle;
z=data1.Zposition;
x = r.*cosd(t);
y = r.*sind(t);
DT = delaunay(x, y);
Warning: Duplicate data points have been detected and removed.
Some point indices will not be referenced by the triangulation.
trisurf(DT,x,y,z,r, 'EdgeColor', 'none')
view(3)

5 件のコメント

Karolina
Karolina 2022 年 9 月 3 日
編集済み: Karolina 2022 年 9 月 3 日
Thank You, but I see, that it has only one value in Z axis - 80. I would like to, that it would look similar to this one below (this one below is made of plot3(), I want surf):
Chunru
Chunru 2022 年 9 月 4 日
Then you need to replace the data.
Karolina
Karolina 2022 年 9 月 6 日
I have tried, but I'm sorry, I don't know how to get things done. Anyway, thank You very much.
Chunru
Chunru 2022 年 9 月 6 日
Please provide the data with different Z values.
Karolina
Karolina 2022 年 9 月 8 日
Oh, I see, what I did wrong! Thank You a lot!! It works now!

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2021a

タグ

質問済み:

2022 年 9 月 3 日

コメント済み:

2022 年 9 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by