Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6203
| From | Ziyuan Lin <ziyuang@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | How the GaussianMatrix is calculated in Mathematica? |
| Date | 2011-11-05 09:54 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j9314l$ac8$1@smc.vnet.net> (permalink) |
GaussianMatrix[1] is something like this:
{{0.00987648, 0.0796275, 0.00987648},
{0.0796275, 0.641984, 0.0796275},
{0.00987648, 0.0796275, 0.00987648}}
I tried to re-implement it by
MyGaussianMatrix[r_] :=
Module[{\[Sigma] = r/2, m},
m = N[Table[
1/(2 \[Pi] \[Sigma]^2) E^(-((x^2 + y^2)/(2 \[Sigma]^2))), {x, -r,
r}, {y, -r, r}]]; m/(Total[Flatten[m]])]
(* To ensure the sum of all entries is 1 *)
But that is not the case, since MyGaussianMatrix[1] will be
{{0.0113437, 0.0838195, 0.0113437},
{0.0838195, 0.619347, 0.0838195},
{0.0113437, 0.0838195, 0.0113437}}
So I wonder the implementation detail of this function.
Thank you~
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
How the GaussianMatrix is calculated in Mathematica? Ziyuan Lin <ziyuang@gmail.com> - 2011-11-05 09:54 +0000 Re: How the GaussianMatrix is calculated in Mathematica? Silvia <wyelen@gmail.com> - 2011-11-06 10:55 +0000
csiph-web