I have a N*N matrix depicting the intensities at different points in a circular plane. They are different intensities on a disc. How to plot the image?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a 10*10 matrix, M depicting the intensities at different points in a disc. The radial vectors of disc is divided as linspace(-1,1 10) and the angle is divided as (0,2*pi,10). Each element in the matrix Mij shows the magnitude for ith radial vector and jth angle. How can we plot the magnitude values in the circular disc space.
回答 (1 件)
Matt J
2025 年 3 月 15 日
編集済み: Matt J
2025 年 3 月 16 日
clc, close all force
N = 10; % Number of polar samples
M = peaks(N); % Example heat map data
T = linspace(0, 2*pi, N)'; % Angular samples
R = linspace(0, 1, N); % Radial samples
[X,Y]=pol2cart(T,R);
figure
pcolor(X, Y, M);
shading interp
colormap(jet)
colorbar
axis equal
title('Polar Heat Map')
2 件のコメント
David Goodmanson
2025 年 3 月 15 日
編集済み: David Goodmanson
2025 年 3 月 15 日
Hi Akhil/Matt
The command in the answer should be
[X,Y] = pol2cart(T,R)
The code provides the answer but depending on your data you can make things look smoother with
N = 10; % Number of polar samples
N1 = 180; % 2 degree steps
M = peaks(N); % Example heat map data
theta = linspace(0, 2*pi, N); % Angular samples
r = linspace(0, 1, N); % Radial samples
theta1 = linspace(0, 2*pi, N1); % Angular samples
r1 = linspace(0, 1, N1); % Radial samples
[R, T] = meshgrid(r, theta); % Create polar grid
[R1 T1] = meshgrid(r1,theta1); % Create polar grid
M1 = interp2(R,T,M,R1,T1);
[X1,Y1] = pol2cart(T1,R1)
figure(2)
pcolor(X1, Y1, M1);
shading interp
colormap(jet)
colorbar
axis equal
title('Polar Heat Map')

Matt J
2025 年 3 月 16 日
Or perhaps,
N = 10; % Number of polar samples
M = peaks(N); % Example heat map data
Ms=interp2(M,5); %upsampled/smoothed M
T = linspace(0, 2*pi, width(Ms))'; % Angular samples
R = linspace(0, 1, height(Ms)); % Radial samples
[X,Y]=pol2cart(T,R);
figure
pcolor(X,Y,Ms);
shading interp
colormap(jet)
colorbar
axis equal
title('Polar Heat Map')
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!