a disc in a matrix
13 次查看(过去 30 天)
显示 更早的评论
I need a disc inside a matrix. for example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154606/image.png)
thanks for your help:)
0 个评论
采纳的回答
更多回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Denoising and Compression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!