Extracting radially symmetric data from a matrix

4 ビュー (過去 30 日間)
MatlabUser17
MatlabUser17 2018 年 5 月 15 日
コメント済み: Rena Berman 2018 年 5 月 30 日
Hi. I have a 2D matrix which I can plot using imagesc with respect to distance: x and y (from -xs to +xs). Here's how I discretize my data on x and y:
xs=D./2;
dx=2.*xs./N;
dy=dx;
X=linspace(-xs,xs,N);
Y=linspace(-xs,xs,N);
[x y]=meshgrid(X,Y);
r1=(x.^2+y.^2).^(0.5);
TH1=atan2(y,x);
Now I need to extract radially symmetric sets of data for further analyzing. I mean from 0 to r1. How should I choose the width of r? If I have two matrices like this, how can I interpolate and compare the data on the same 'r' from one matrix with the other one? Thanks
  1 件のコメント
Rena Berman
Rena Berman 2018 年 5 月 30 日
(Answers Dev) Restored edit

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2018 年 5 月 16 日
Do you want something like this:
D = 10
N = 100
xs=D./2;
dx=2.*xs./N;
dy=dx;
X=linspace(-xs,xs,N);
Y=linspace(-xs,xs,N);
[x y]=meshgrid(X,Y);
r1=(x.^2+y.^2).^(0.5);
subplot(2, 2, 1);
imshow(r1, []);
axis on;
circleMask = r1 < 3;
subplot(2, 2, 2);
imshow(circleMask, []);
axis on;
r2 = r1 .* double(circleMask);
subplot(2, 2, 3);
imshow(r2, []);
axis on;
% Get mean of r1 image inside circle mask
mean_r1 = mean(r1(circleMask))
message = sprintf('The mean of r1 inside the circle mask = %f', mean_r1);
uiwait(helpdlg(message));
  4 件のコメント
MatlabUser17
MatlabUser17 2018 年 5 月 16 日
I do have the toolbox. How should I do it? So we get radial distribution of intensity line?
Image Analyst
Image Analyst 2018 年 5 月 17 日
No, pass the coordinates of the circle perimeter (your x and y) into improfile().

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by