Mapping a periodic planar surface onto a cylinder
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nick K
am 9 Dez. 2020
Bearbeitet: Casey Bartlett
am 9 Dez. 2020
I have a periodic rough 2D surface in an array V(x,y) which I want to map into a 3D rough surface around a cylinder radius R. (Like pictured)
My coordinate transforms are rusty and I cant work out how to do this mapping. Does somebody know how to acheive this for my generic non-analytic surface?
If possible please avoid solutions using Matlab's "cylinder" function, as I want to port this to another language.
Thanks in advance :)
0 Kommentare
Akzeptierte Antwort
Casey Bartlett
am 9 Dez. 2020
Bearbeitet: Casey Bartlett
am 9 Dez. 2020
You are interested in mapping a set of data x,y,V(x,y) in cartesian coordinates to cylindrical coordinates (specifically avoiding the 'cylinder' function). There are many ways to do this, but here is an example that uses trigonometric functions to do the transform. Plotting is done with 'Mesh'. Its worth taking a look at the documentation for cart2pol for more information on this transformation.
1. Generate data V(x,y)
% Assumptions
% 1. The structure of points x,y in V(x,y) is consistent with meshgrid
% 2. The domain is periodic in the x direction
% 3. If the data roughly approximates a cylider, the displacement of the
% data from the surface of the cylinder \delta r, is much smaller than the
% cylinder radius R (\delta r << R).
% 4. the data is only periodic in one direction (It may be appropriate to visualize with
% a toroid if the data is periodic in both x and y).
% vector of 'x' coordinates
x = 0:0.5:10;
% vector of 'y' coordinates
y = 1:1:20;
% Create some 'noisy' data
[X,Y] = meshgrid(x,y);
V = rand(size(X))*0.5; % V(X,Y);
% To ensure the data is periodic
V(:,end) = V(:,1);
2. Transform the data to polar coordinates to obtain the desired surface R(\theta,z), then remap back to cartesian coordinates for plotting:
L = max(x);
% Map the cartesian to cylindrical coordinates R, \theta, z
Theta = X / L * 2 *pi;
radius = @(circumference) circumference / 2*pi;
R0 = radius(L);
R = V + R0;
% With the above mapping, plot in cartesian
% with Z = Y
% X = r cos(\theta)
% Y = r sin(\theta)
Xtheta = R .* cos(Theta);
Ytheta = R .* sin(Theta);
Z = Y;
mesh(Xtheta, Ytheta, Z)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!