a disc in a matrix

4 vues (au cours des 30 derniers jours)
Amy
Amy le 4 Jan 2014
Modifié(e) : Amy le 3 Fév 2014
I need a disc inside a matrix. for example:
thanks for your help:)

Réponse acceptée

Walter Roberson
Walter Roberson le 4 Jan 2014
  2 commentaires
Amy
Amy le 2 Fév 2014
sorry.where can i find the sol? ><
Walter Roberson
Walter Roberson le 2 Fév 2014

Connectez-vous pour commenter.

Plus de réponses (1)

Roger Stafford
Roger Stafford le 2 Fév 2014
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

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by