How to "circularize" a 1-D plot into a 2-D image

I have written a script that generates a 1-D plot of modulation trasnfer function (MTF) vs. frequency. I want to use this to create a 2-D image of the MTF by "circularizing" the 1-D plot about the center of an image.
I want to go from this:
to something that looks like this:

回答 (1 件)

DGM
DGM 2022 年 4 月 23 日

0 投票

Depending on what you need, this may be a start.
% define TF curve
tfr = [0 1.3 4];
tfz = [1 1 0.2];
% array setup
maxxy = 4;
npoints = 101;
% calculate x,y,z
x = linspace(-maxxy,maxxy,npoints);
y = x.';
[th r] = cart2pol(x,y);
z = interp1(tfr,tfz,r,'linear','extrap');
% plot it
pcolor(x,y,z);
shading flat
colormap(gray)
colorbar
Depending on your needs, you may want to adjust how the extrapolation is handled. You can disable the extrapolation or specify a constant extrapolation value to use. Also, you may choose to clamp the extrapolated regions at some value (e.g. zero, using max(z,0)).

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

製品

リリース

R2022a

質問済み:

2022 年 4 月 23 日

回答済み:

DGM
2022 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by