I need a disc inside a matrix. for example:
thanks for your help:)

 採用された回答

Walter Roberson
Walter Roberson 2014 年 1 月 4 日

0 投票

2 件のコメント

Amy
Amy 2014 年 2 月 2 日
sorry.where can i find the sol? ><
Walter Roberson
Walter Roberson 2014 年 2 月 2 日

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

その他の回答 (1 件)

Roger Stafford
Roger Stafford 2014 年 2 月 2 日

0 投票

It would be better to use the term 'disk' or 'disc' for this. The term 'circle' generally refers to the one-dimensional curve surrounding a two-dimensional disk.
Let ic and jc be the desired indices for the disk's center and r be its radius, and let m and n be the numbers of rows and columns, respectively, in the array.
[I,J] = ndgrid(1:m,1:n);
M = double((I-ic).^2+(J-jc).^2<=r^2); % <-- M should be your desired array

タグ

質問済み:

Amy
2014 年 1 月 4 日

編集済み:

Amy
2014 年 2 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by