If I start with a matrix of zeros, how can I easily create a Hypocycloid of ones in that matrix?

2 ビュー (過去 30 日間)
I want to make an Hypocycloid with a matrix of zeros, it is for make the Fourier Transformation of the image. Something like this https://la.mathworks.com/help/images/fourier-transform.html but instead the Rectangle I need a Hypocycloid like the examples of this page https://es.wikipedia.org/wiki/Hipocicloide when K=3,4 and 5
I need this in Matlab, but not like a plot because the fast fourier transformation doesn't let make the FT to plots
  2 件のコメント
Jan
Jan 2022 年 3 月 9 日
Please mention the details. How should the "hypocycloid" look like? What have you tried so far? What is "the TF"?
Carlos Santiago Rodríguez Sarmiento
I've just actuallized the question, TF is because I wrote thinking the concept in Spanish ( Transformada de Fourier) but is FT (Fourier Transformation)

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

回答 (1 件)

Jan
Jan 2022 年 3 月 10 日
編集済み: Jan 2022 年 3 月 11 日
A point to start from - it is not hard to expand this to fill elements of the zero matrix:
M = zeros(512, 512);
a = linspace(0, 2*pi, 10000);
% Hypocycloid:
r1 = 1;
r2 = 0.2; % 1/n
x = (r1 - r2) * cos(a) + r2 * cos(a * (1 - r1 / r2));
y = (r1 - r2) * sin(a) + r2 * sin(a * (1 - r1 / r2));
xx = 1 + round((x + 1) / 2 * 511);
yy = 1 + round((y + 1) / 2 * 511);
M(sub2ind(size(M), xx, yy)) = 1;
% Circle:
x = r1 * cos(a);
y = r1 * sin(a);
xx = 1 + round((x + 1) / 2 * 511);
yy = 1 + round((y + 1) / 2 * 511);
M(sub2ind(size(M), xx, yy)) = 1;
colormap([1,1,1; 0,0,0]) % Display the matrix:
image(M + 1)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by