Borrar filtros
Borrar filtros

Rotating a line plot to obtain a 360-degree color map

19 visualizaciones (últimos 30 días)
Keyur Savla
Keyur Savla el 12 de Jul. de 2024 a las 19:27
Respondida: Star Strider el 12 de Jul. de 2024 a las 20:47
I would like to rotate the line plot on the left about its central point to create a 360 degree color map, that looks somewhat like to the image on the right. Any suggestion on how to rotate and extrapolate the data?

Respuestas (1)

Star Strider
Star Strider el 12 de Jul. de 2024 a las 20:47
Itt would help to have the data.
It also appears that the line is not the same everywhere (it may be part of a matrix), although only one line (most likely row) is shown.
One ap;proach is tot create a matrix from it as a function of an angle, and then use the pol2cart function to transform it into Cartesian coordinates —
Nr = 250;
th = linspace(0, 2*pi, Nr);
Nc = 50;
rv = linspace(0, 3.5*pi, Nc);
r = cos(rv) + 1;
figure
plot(rv, r)
[T,R] = ndgrid(th, rv);
A = repmat(r, Nr, 1);
figure
surf(T, R, A, 'EdgeColor','none')
colormap(turbo)
colorbar
[X,Y,Z] = pol2cart(T, R, A);
figure
surf(X, Y, Z, 'EdgeColor','interp')
colormap(turbo)
colorbar
figure
surf(X, Y, Z, 'EdgeColor','interp')
colormap(turbo)
colorbar
axis('equal')
view(0,90)
Depending on how you want it to look, another option is tto use contourf
figure
contourf(X, Y, Z, 'LineColor','none')
colormap(turbo)
colorbar
axis('equal')
This is my best guess.

Categorías

Más información sobre Purple en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by