Rotating a line plot to obtain a 360-degree color map
19 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
Star Strider
2024-7-12,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)
figure
contourf(X, Y, Z, 'LineColor','none')
colormap(turbo)
colorbar
axis('equal')
This is my best guess.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Purple 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!