필터 지우기
필터 지우기

a disc in a matrix

조회 수: 4 (최근 30일)
Amy
Amy 2014년 1월 4일
편집: Amy 2014년 2월 3일
I need a disc inside a matrix. for example:
thanks for your help:)

채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 4일
  댓글 수: 2
Amy
Amy 2014년 2월 2일
sorry.where can i find the sol? ><

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Roger Stafford
Roger Stafford 2014년 2월 2일
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

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by