Plotting thickness data to a cylinder.

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 comentarios

darova
darova el 1 de Mayo de 2020
Do you have any picture? What result you are expecting?
Andy M
Andy M el 1 de Mayo de 2020
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 el 1 de Mayo de 2020
Can you attach the data? For my expertiments
Andy M
Andy M el 1 de Mayo de 2020
I have atached the data sample I've been playing with.

Iniciar sesión para comentar.

 Respuesta aceptada

darova
darova el 1 de Mayo de 2020
Editada: darova el 1 de Mayo de 2020
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 comentarios

Andy M
Andy M el 1 de Mayo de 2020
Thank you so much, that worked perfectly!
SHIVA LADI
SHIVA LADI el 12 de Nov. de 2020
Can you please attach the test matlab.xlsx fie.
M J
M J el 11 de Oct. de 2021
I never saw the .xlsx file for this solution, it looks like it was attached but it doesn't show?
Simson Hutagalung
Simson Hutagalung el 5 de Jul. de 2022
Can you show the excel file? Thank you

Iniciar sesión para comentar.

Más respuestas (1)

Ameer Hamza
Ameer Hamza el 1 de Mayo de 2020
Editada: Ameer Hamza el 1 de Mayo de 2020
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])

Preguntada:

el 1 de Mayo de 2020

Comentada:

el 5 de Jul. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by