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

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Jan. 2014

0 Stimmen

Weitere Antworten (1)

Roger Stafford
Roger Stafford am 2 Feb. 2014

0 Stimmen

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

Kategorien

Tags

Gefragt:

Amy
am 4 Jan. 2014

Bearbeitet:

Amy
am 3 Feb. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by