DiskMatrix

DiskMatrix[r]

gives a matrix whose elements are 1 in a disk-shaped region of radius r, and are otherwise 0.

DiskMatrix[r,w]

gives a w×w matrix containing a disk of 1s with radius r.

DiskMatrix[{r1,r2,},]

yields an array whose elements are 1 in an ellipsoidal region with semiaxis ri in the i^(th) index direction.

Details and Options

  • The disk of 1s is always at the center of the region.
  • In DiskMatrix[r] or DiskMatrix[{r1,}] the matrix or array is sized so as to just include all nonzero elements.
  • The disk-like region is taken to be the best discrete approximation to a circular disk possible given the size of the matrix.
  • DiskMatrix[All,w] gives a w×w matrix containing a disk that is as large as possible.
  • DiskMatrix[,{w1,w2,}] gives a w1×w2× array.
  • DiskMatrix[{r1,,rn},w] gives a w××w array.
  • DiskMatrix[All,{w1,,wn}] gives a w1××wn array containing an ellipsoid that is as large as possible.
  • The radius r need not be an integer; in general elements are 1 if their distance from the center is not more than .
  • For integer r, DiskMatrix[r] yields a (2r+1)×(2r+1) matrix.

Examples

open allclose all

Basic Examples  (1)

This computes and plots a square disk-shaped matrix of radius 7:

Scope  (6)

Create a square matrix:

Create a rectangular ellipse-shaped matrix:

Put a disk inside a bigger matrix:

Extend the disk to the boundaries of the matrix:

Automatically choose an odd width to just fit the disk:

Extend the disk to the given width, and automatically choose the height:

Wolfram Research (2008), DiskMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/DiskMatrix.html.

Text

Wolfram Research (2008), DiskMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/DiskMatrix.html.

CMS

Wolfram Language. 2008. "DiskMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DiskMatrix.html.

APA

Wolfram Language. (2008). DiskMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiskMatrix.html

BibTeX

@misc{reference.wolfram_2024_diskmatrix, author="Wolfram Research", title="{DiskMatrix}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/DiskMatrix.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_diskmatrix, organization={Wolfram Research}, title={DiskMatrix}, year={2008}, url={https://reference.wolfram.com/language/ref/DiskMatrix.html}, note=[Accessed: 21-November-2024 ]}