First off, I am completely new to MATLAB and not really sure where to start.
I have large datasets (approximately 170,000 points) that I am trying to plot to a cylinder surface. It is Ultrasonic thickness readings taken about the circumference of a pipe.
I have X, Y, Z coordinates for every point and would like to display the thickness reading value as a colormap, any recommendations would be greatly appreciated.
*Edit..... I've attached a photo of the original excel data, rows represent circumferential position, columns length about the pipe axis and the color pallet represents remaining wall thickness (in this instance between 12mm-20mm)
Ideally I would like to be able to plot to be a representative image of the pipe itself as pictured (that was just cheated by applying an image of the excel data to a pipe section as a material in AutoCAD)

댓글 수: 5

darova
darova 2020년 5월 1일
Do you have any picture? What result you are expecting?
Andy M
Andy M 2020년 5월 1일
I was able to find some guidance in answers to be able to plot the cylinder to the correct size, with the correct amount of divisions in circumferential and Z axis, but am having trouble linking the data to generate the colormap.
For the example I am using data a 600 x 35 test sample (600 points about circumference, 35 long) just not sure how to add it in. The following was provided by another user which gets the cylinder size right but I dont know how to input my data for the colormap to represent remaining wall thickness
Radius = 300. ; % Radius of the cylindrical shell
theta = 360. ; % Angle of the Cylinder
Height = 35. ; % Height of the Cylinder
%
NH = 35 ; % Number of Elements on the Height
NT = 600 ; % Number of Angular Dicretisation
% Discretizing the Height and Angle of the cylinder
nH = linspace(0,Height,NH) ;
nT = linspace(0,theta,NT)*pi/180 ;
[H, T] = meshgrid(nH,nT) ;
% Convert grid to cylindrical coordintes
X = Radius*cos(T);
Y = Radius*sin(T);
Z = H ;
th = linspace(0,2*pi) ;
R = @(th) [1 0 0 ;0 cos(th) -sin(th) ; 0 sin(th) cos(th)] ; % rotation matrix alon x-axes
h = surf(X,Y,Z) ;
axis([-2 2 -2 2 -2 2])
coor = [X(:) Y(:) Z(:)] ;
for i = 1:length(th)
coor1 = coor*R(th(i)) ;
X1 = reshape(coor1(:,1),NT,NH) ;
Y1 = reshape(coor1(:,2),NT,NH) ;
Z1 = reshape(coor1(:,3),NT,NH) ;
set(h,'XData',X1,'YData',Y1,'ZData',Z1) ;
drawnow
pause(0.1)
end
darova
darova 2020년 5월 1일
Can you attach the data? For my expertiments
Andy M
Andy M 2020년 5월 1일
I have atached the data sample I've been playing with.

댓글을 달려면 로그인하십시오.

 채택된 답변

darova
darova 2020년 5월 1일
편집: darova 2020년 5월 1일

1 개 추천

Use this
A = xlsread('test matlab.xlsx');
%%
x = A(:,2);
y = A(:,3);
T = A(:,5:end);
z = 1:size(t,2); % 1 2 3 ... number of columns
[X,Z] = ndgrid(x,z); % 2d matrix
[Y,~] = ndgrid(y,z); % 2d matrix
surf(X,Y,Z,T,'edgecolor','none')
axis vis3d
view(3)
opengl software
caxis([15 23])
colorbar
5

댓글 수: 4

Andy M
Andy M 2020년 5월 1일
Thank you so much, that worked perfectly!
SHIVA LADI
SHIVA LADI 2020년 11월 12일
Can you please attach the test matlab.xlsx fie.
M J
M J 2021년 10월 11일
I never saw the .xlsx file for this solution, it looks like it was attached but it doesn't show?
Can you show the excel file? Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 5월 1일
편집: Ameer Hamza 2020년 5월 1일

0 개 추천

I don't understand what you are trying to do inside the for-loop, but the following code shows how to map a texture on a cylinder surface. I used an image as a texture map. You can adapt it according to your need.
im = imread('peacock.jpg');
r = 5;
[X,Y,Z] = cylinder(r, 100);
h = 20;
Z = Z*h;
surf(X, Y, Z, flip(im), 'FaceColor', 'texturemap', 'EdgeColor', 'none');
daspect([1 1 1])

카테고리

질문:

2020년 5월 1일

댓글:

2022년 7월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by