How I make circular grid without using meshgrid or rectangle?

3 ビュー (過去 30 日間)
omar Alwan
omar Alwan 2014 年 12 月 10 日
コメント済み: Anonymous 2018 年 4 月 11 日
I made circle grid by using meshgrid of X and Y.Then I took the circle formula from the rectangular grid by following this code:
>>[x,y]=meshgrid(-128:127,-128:127); %(replicates the grid vectors from -128 to 127 to produce a full grid. This gridis represented by the output coordinate arrays X and Y).
>>z=sqrt(x.^2+y.^2); % is the formula for having the circle (Matrix) >>c=(z<14); % to cutoff 14 value >>figure,imshow(c)
My question is :How I make circular grid directly instead of making square or rectangle grid and then making circular formula with cutoff???
I hope to find the solution from the members in this website
thank you
  1 件のコメント
Anonymous
Anonymous 2018 年 4 月 11 日
How would I change the color of this circle? Also, how would I add another circle like this?

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

回答 (1 件)

Jos (10584)
Jos (10584) 2014 年 12 月 10 日
I think your approach is very straightforward. Everything I can think of right that does not generate grid points being thrown away later involves looping twice.
Moreover, your variable C needs to be rectangular if it is used by imshow ...

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by