フィルターのクリア

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

19 ビュー (過去 30 日間)
Keyur Savla
Keyur Savla 2024 年 7 月 12 日 19:27
回答済み: Star Strider 2024 年 7 月 12 日 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?

回答 (1 件)

Star Strider
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)
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.

カテゴリ

Help Center および File ExchangePurple についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by