Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: rician random number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15208] Re: [mg15145] Re: [mg15117] rician random number
  • From: BobHanlon at aol.com
  • Date: Tue, 22 Dec 1998 04:01:39 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

The following expands upon my earlier response.  The distribution of the
Rician distributed random numbers is displayed as well as the source
Rician distribution and the MLE estimate of the distribution. 
Additional descriptive statistics are given for the Rician
distribution.

Bob Hanlon
_______________________

Notebook[{
Cell["\<\
Needs[\"Statistics`ContinuousDistributions`\"];
Needs[\"Statistics`DescriptiveStatistics`\"];
Needs[\"Statistics`DataManipulation`\"];
Needs[\"Graphics`Graphics`\"];\
\>", "Input",
  InitializationCell->True],

Cell[TextData[{
  "Unprotect[RicianDistribution];\nClear[RicianDistribution];\n\n\
RicianDistribution::usage = \n  \"RicianDistribution[A, \[Sigma]]
represents \ the continuous Rician\n  distribution (also known as
Nakagami-Rice or \ n-distribution)\n  with parameters A and \[Sigma]. 
Special case: Rayleigh (A\ \[NonBreakingSpace]=
0).\";\n\nRicianDistribution::posparm = \n\t\"Parameter \ `1` is
expected to be positive.\";\n\nRicianDistribution::nonnegparm = \n\t\
\"Parameter `1` is expected to be nonnegative.\";\n\n\
RicianDistribution::realparm = \n\t\"Parameter `1` is expected to be
real.\";\ \n\nRicianDistribution/: \n\t",
  StyleBox["ParameterQ",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := And[\n\t\tIf[FreeQ[N[A],
Complex], \ True,\n\t\t\tMessage[RicianDistribution::realparm, A];
False],\n\t\t\ If[FreeQ[N[\[Sigma]], Complex], True,\n\t\t\t\
Message[RicianDistribution::realparm, \[Sigma]]; False],\n\t\tIf[N[A]
>= 0, \ True,\n\t\t\tMessage[RicianDistribution::nonnegparm, A]; False,
True],\n\t\t\ If[N[\[Sigma]] > 0,
True,\n\t\t\tMessage[RicianDistribution::posparm, \ \[Sigma]]; False,
True]];\n\nRicianDistribution/: \n\t",
  StyleBox["DomainQ",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], alist_?VectorQ] := \n\t\t\
FreeQ[N[alist], Complex] &&\n\t\tScan[If[!TrueQ[# >= 0],
Return[False]]&, \ alist] =!= False;\n\nRicianDistribution/: \n\t",
  StyleBox["DomainQ",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], r_] := \n\t\tFreeQ[N[r], Complex]
&& \ TrueQ[r >= 0];\n\nRicianDistribution/: \n\t",
  StyleBox["Domain",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[___]] := Interval[{0, Infinity}];\n\n\
RicianDistribution/: \n\t",
  StyleBox["PDF",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], r_ /; !Positive[r]] := 0 /;
\n\t\t\ ParameterQ[RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["PDF",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], r_] := (r/\[Sigma]^2) *\n\t\t\
Exp[-(r^2+A^2)/(2*\[Sigma]^2)] BesselI[0, r*A/\[Sigma]^2] /;
ParameterQ[\n\t\t\
\tRicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["Moment",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], n_] := \n\t\t2^(n/2) \[Sigma]^n \
Gamma[1 + n/2] * \n\t\t\tLaguerreL[n/2, -A^2/(2 \[Sigma]^2)] /;
ParameterQ[\n\ \t\t\t\tRicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["CentralMoment",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], n_Integer] := \n\t\tModule[{\[Mu]
= \ Mean[RicianDistribution[A, \[Sigma]]], m},\n\t\t\tSum[Binomial[n,
m] \ Moment[RicianDistribution[A, \[Sigma]], m] *
\n\t\t\t(-\[Mu])^(n-m), {m, 0, \ n}]] /;
ParameterQ[\n\t\t\t\tRicianDistribution[A, \[Sigma]]];\n\n\
RicianDistribution/: \n\t",
  StyleBox["Mean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := Evaluate[\n\t\t\
Moment[RicianDistribution[A, \[Sigma]], 1]] /; ParameterQ[\n\t\t\t\
RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["Variance",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] :=
\n\t\tEvaluate[Simplify[\n\t\t\t\ Moment[RicianDistribution[A,
\[Sigma]], 2] - \n\t\t\t\ Mean[RicianDistribution[A, \[Sigma]]]^2]] /;
ParameterQ[\n\t\t\t\t\ RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["StandardDeviation",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := Evaluate[\n\t\t\
Sqrt[Variance[RicianDistribution[A, \[Sigma]]]]] /;
ParameterQ[\n\t\t\t\ RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["GeneralizedMean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], t_ /; t == 0] := \n\t\t\
GeometricMean[RicianDistribution[A, \[Sigma]]] /; ParameterQ[\n\t\t\t\
RicianDistribution[A, \[Sigma]]]; (* ",
  StyleBox["Limit t -> 0",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["GeneralizedMean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], t_] := \n\t\tSqrt[2] \[Sigma]
(Gamma[1 \
+ t/2] * \n\t\t\tLaguerreL[t/2, -A^2/(2 \[Sigma]^2)])^(1/t) /;
ParameterQ[\n\t\
\t\t\tRicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["HarmonicMean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := Evaluate[\n\t\t\
GeneralizedMean[RicianDistribution[A, \[Sigma]], -1]] /;
ParameterQ[\n\t\t\t\ RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["GeometricMean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_]] := \n\t\t\
Sqrt[2]*Exp[-EulerGamma/2]*\[Sigma] /; ParameterQ[\n\t\t\t\
RicianDistribution[A, \[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["GeometricMean",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := \n\t\tA*Exp[1/2*Gamma[0,
A^2/(2*\ \[Sigma]^2)]] /; ParameterQ[\n\t\t\tRicianDistribution[A,
\[Sigma]]]; (* ",
  StyleBox["Exp[ExpectedValue[Log[R]]]",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["RootMeanSquare",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := \n\t\t\[Sigma]
Sqrt[A^2/\[Sigma]^2 \ + 2] /; ParameterQ[RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \ \n\t",
  StyleBox["Mode",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_]] := \[Sigma] /; \n\t\t\
ParameterQ[RicianDistribution[A, \[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["Mode",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_?NumericQ, \[Sigma]_?NumericQ]] :=  \n\t\t\
Module[{dist = RicianDistribution[A, \[Sigma]], r, dpdf}, \n\t\t\tdpdf
= \ D[PDF[dist, r], r];\n\t\t\tr /. FindRoot[dpdf == 0, {r,
Mean[dist]}]] /; \n\t\ \t\t\tParameterQ[RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\ \t",
  StyleBox["Median",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_]] :=
\[Sigma]*Sqrt[2*Log[2]] \ /; \n\t\tParameterQ[RicianDistribution[A,
\[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["Median",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_?NumericQ, \[Sigma]_?NumericQ]] := \n\t\t\
Quantile[RicianDistribution[A, \[Sigma]], .5] /; \n\t\t\t\
ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/:
\n\t",
  StyleBox["Skewness",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := \n\t\t\
Evaluate[CentralMoment[RicianDistribution[A, \[Sigma]], 3] / \n\t\t\
StandardDeviation[RicianDistribution[A, \[Sigma]]]^3] /; \n\t\t\t\
ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/:
\n\t",
  StyleBox["Kurtosis",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := \n\t\t\
Evaluate[CentralMoment[RicianDistribution[A, \[Sigma]], 4] / \n\t\t\
Variance[RicianDistribution[A, \[Sigma]]]^2] /; \n\t\t\t\
ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/:
\n\t",
  StyleBox["KurtosisExcess",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_]] := \n\t\t\
Evaluate[Kurtosis[RicianDistribution[A, \[Sigma]]] - 3] /; \n\t\t\t\
ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/:
\n\t",
  StyleBox["CDF",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], r_ /; !Positive[r]] := \n\t\t0 /;
\ ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/:
\n\t",
  StyleBox["CDF",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_], r_] := \n\t\t1 - \
Exp[-(r^2/(2*\[Sigma]^2))] /; ParameterQ[\n\t\t\tRicianDistribution[A,
\ \[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["CDF",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_?NumericQ, \[Sigma]_?NumericQ], r_?NumericQ] :=
\n\t\ \tNIntegrate[PDF[RicianDistribution[A, \[Sigma]], x], \n\t\t\t{x,
0, r}] /; \ ParameterQ[RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["Quantile",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_, \[Sigma]_], x_ /; x == 0] := 0 /; \n\t\t\
QuantileQ[x] && ParameterQ[RicianDistribution[A, \[Sigma]]];\n\n\
RicianDistribution/: \n\t",
  StyleBox["Quantile",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_], x_] := \n\t\t\
\[Sigma]*Log[1/(1 - x)^2]^(1/2) /; QuantileQ[x] && ParameterQ[\n\t\t\t\
RicianDistribution[A, \[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["Quantile",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_?NumericQ, \[Sigma]_?NumericQ], x_] := \n\t\t\
Module[{r, \n\t\t\tinvcdf = \[Sigma] * Sqrt[-2 Log[1 - x]]}, \n\t\t\tr
/. \ FindRoot[CDF[RicianDistribution[A, \[Sigma]], r] == x, \n\t\t\t{r,
invcdf}, \ Jacobian -> \n\t\t\t{{PDF[RicianDistribution[A, \[Sigma]],
r]}}]\n\t\t] /; \ QuantileQ[x] && ParameterQ[RicianDistribution[A,
\[Sigma]]];\n\n\ RicianDistribution/: \n\t",
  StyleBox["CharacteristicFunction",
    FontColor->RGBColor[0, 0, 1]],
  "[\n\t\tRicianDistribution[A_ /; A == 0, \[Sigma]_], t_] := \n\t\t\
Evaluate[CharacteristicFunction[\n\t\t\tRayleighDistribution[\[Sigma]],
t]] \ /; ParameterQ[\n\t\t\t\tRicianDistribution[A, \[Sigma]]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["ExpectedValue",
    FontColor->RGBColor[0, 0, 1]],
  "[f_Function, RicianDistribution[A_, \[Sigma]_], \n\topts___?OptionQ]
:=\n \
Module[{x, integral, assmp = Assumptions /. {opts} /. \
Options[ExpectedValue]},\n   (\n\tintegral\n   ) /; (integral = \
Integrate[f[x] PDF[RicianDistribution[A, \[Sigma]], x],\n\t\t\t{x, 0, \
Infinity},\n\t\t\tAssumptions -> Join[{A/\[Sigma]^2 > 0, \[Sigma] > 0},
\ assmp]];\n\t FreeQ[integral, Integrate])\n  ] /; \
ParameterQ[RicianDistribution[A, \[Sigma]]];\n\nRicianDistribution/: ",
  StyleBox["ExpectedValue",
    FontColor->RGBColor[0, 0, 1]],
  "[f_, RicianDistribution[A_, \[Sigma]_],\n\tx_Symbol, opts___?OptionQ]
:=\n \
 Module[{integral, assmp = Assumptions /. {opts} /.
Options[ExpectedValue]},\n\
    (\n\tintegral\n    ) /; (integral = Integrate[f
PDF[RicianDistribution[A, \
\[Sigma]], x],\n\t\t{x, 0, Infinity}, Assumptions -> Join[{A/\[Sigma]^2
> 0, \ \[Sigma] > 0}, assmp]];\n          FreeQ[integral, Integrate])\n
] /; \ ParameterQ[RicianDistribution[A,
\[Sigma]]];\n\nRicianDistribution/: \n\t",
  StyleBox["Random",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A == 0, \[Sigma]_ /; \[Sigma] > 0]] :=
\n\t\t\ Random[RayleighDistribution[sigma]]; (* ",
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["Random",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A > 0, \[Sigma]_ /; \[Sigma] > 0]] :=
\n\t\t\ Sqrt[Random[NormalDistribution[A/Sqrt[2], \[Sigma]]]^2 +
\n\t\t\t\ Random[NormalDistribution[A/Sqrt[2],
\[Sigma]]]^2];\n\nRicianDistribution/: \n\
\t",
  StyleBox["RandomArray",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[\n\t\tA_ /; A == 0, \[Sigma]_ /; \[Sigma] > 0], \
n_Integer] :=\n  \t\tTable[Random[RayleighDistribution[\[Sigma]]],
{n}]; (* ",
  
  StyleBox["Rayleigh",
    FontColor->RGBColor[1, 0, 0]],
  " *)\n\nRicianDistribution/: \n\t",
  StyleBox["RandomArray",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_ /; A > 0, \[Sigma]_ /; \[Sigma] > 0], \n\t\t\
n_Integer] :=\n  \t\t\tTable[Random[RicianDistribution[A, \[Sigma]]],
{n}];\n\ \nRicianDistribution/: \n\t",
  StyleBox["LocationReport",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_?NumericQ, \[Sigma]_?NumericQ]]
:=\n\t\tN[{\n\t\t\ Mean -> Mean[RicianDistribution[A, \[Sigma]]],
\n\t\tHarmonicMean -> \ HarmonicMean[RicianDistribution[A, \[Sigma]]],
\n\t\tMedian -> \ Median[RicianDistribution[A, \[Sigma]]], \n\t\tMode
-> \ Mode[RicianDistribution[A, \[Sigma]]]\n\t\t}] /; \
ParameterQ[RicianDistribution[A,
\[Sigma]]]\n\nRicianDistribution/:\n\t",
  StyleBox["MLEparameters",
    FontColor->RGBColor[0, 0, 1]],
  "[RicianDistribution[A_Symbol, \[Sigma]_Symbol], \n\t\tdata_?VectorQ,
\ opts___?OptionQ] := \n\t\tModule[{eqn, dist = RicianDistribution[A, \
\[Sigma]], \[Mu] = Mean[data], \n\t\t\tvar = Variance[data], a, s},
\n\t\t\t\ eqn = (D[LogLikelihood[dist, data], #] == 0)& /@ {A,
\[Sigma]};\n\t\t\ts = \ Min[\[Mu] * Sqrt[2/Pi], Sqrt[var/2]];\n\t\t\ta
= Sqrt[var + \[Mu]^2 - 2 * \ s^2];\n\t\t\tFindRoot[eqn, {A, a},
{\[Sigma], s}, opts]];\n\n\ SetAttributes[RicianDistribution,
ReadProtected];\n\ Protect[RicianDistribution];"
}], "Input",
  InitializationCell->True],

Cell["\<\
KummerTransform = 
\t(Hypergeometric1F1[a_, b_, z_] -> E^z Hypergeometric1F1[b-a, b, -z]);
\t
LogLikelihood[dist_, data_?VectorQ] := Plus @@ 
\t(PowerExpand[Log[PDF[dist, #]]]& /@ data) /; ParameterQ[dist];\ \>", 
  "Input",
  InitializationCell->True],

Cell[TextData[
"Unprotect[Moment, CentralMoment, HarmonicMean, GeometricMean, \
GeneralizedMean];\n\nMoment::usage = \"Moment[dist, n] is the n-th
moment of \ the\n\tspecified distribution.\";\n\nGeneralizedMean::usage
= \ \"GeneralizedMean[dist, t] is the \n\tgeneralized mean of the
specified \ distribution. \n\tSpecial cases: Arithmetic Mean (t = 1),
HarmonicMean (t = \ -1),\n\tGeometricMean (limit t -> 0),
RootMeanSquare (t = 2).\";\n\n\ Moment[dist_, n_] :=
ExpectedValue[(#^n)&, dist] /; \n\tParameterQ[dist];\n\n\
CentralMoment[dist_, n_Integer] := Module[{\[Mu] = Mean[dist], m},
\n\t\ Sum[Binomial[n, m] * Moment[dist, m] * (-\[Mu])^(n-m), \n\t\t{m,
0, n}]] /; \ ParameterQ[dist];\n\nHarmonicMean[dist_] :=
1/ExpectedValue[(1/#)&, dist] /; \
\n\tParameterQ[dist];\n\nGeometricMean[dist_] := \
Simplify[Exp[ExpectedValue[Log[#]&, dist]]] /;
\n\tParameterQ[dist];\n\n\ GeneralizedMean[dist_, t_ /; t == 0] :=
GeometricMean[dist] /; \n\t\
ParameterQ[dist];\n\nGeneralizedMean[dist_, t_] :=
ExpectedValue[(#^t)&, \ dist]^(1/t) /;
\n\tParameterQ[dist];\n\nProtect[Moment, CentralMoment, \ HarmonicMean,
GeometricMean, GeneralizedMean];"], "Input",
  InitializationCell->True],

Cell[CellGroupData[{

Cell[TextData[
"Clear[A, \[Sigma]];\nrice = RicianDistribution[A, \[Sigma]];"],
"Input"],

Cell["PDF[rice, r]", "Input"]
}, Open  ]],

Cell[TextData[{
  StyleBox["You can generate a Rician distribution by\n\n\tR = ",
"Text"],
  Cell[BoxData[
      \(TraditionalForm\`\ at \(X1\^2 + \ X2\^2\)\)]],
  StyleBox["\n\t\nwhere X1 and X2 are Normal(", "Text"],
  Cell[BoxData[
      \(TraditionalForm\`A\/\ at 2\)]],
  StyleBox[", \[Sigma])", "Text"]
}], "Text"],

Cell[TextData[
"Module[{dist = RicianDistribution[3*Random[], 3*Random[]], \n\tnbr =
100, A, \
\[Sigma], rice, data, \[Mu], stdDev, dataDist, xmax, \n\tfreq, nbrBins =
10, \ step, midpts},\n\trice = RicianDistribution[A, \[Sigma]];\n\tdata
= \ RandomArray[dist, nbr]; \n\t\[Mu] = Mean[data]; \n\tstdDev = \
StandardDeviation[data];\n\txmax = Ceiling[\[Mu] + 2.5 *
stdDev];\n\tdataDist \
= rice /. MLEparameters[rice, data];\n\tstep = N[xmax/nbrBins];\n\tfreq
= \ BinCounts[data, {0, xmax, step}]/(nbr*step);\n\tmidpts = Table[x,
{x, step/2, \
xmax, step}];\n\tBarChart[Transpose[{freq, midpts}], BarSpacing -> -1/5,
\n\t\ \tFrame -> True, Axes -> None, FrameLabel -> \n\t\t\t{\"r\",
\"PDF\\n \", \ \"Distribution of Rician Data (\" <>
\n\t\t\tToString[nbr] <> \" values)\", \ None}, \n\t\tPlotRange -> {0,
Max[1., Max[freq]]}, \n\t\tImageSize -> {400, \
300}];\n\tPrint[Join[{\"Rician Data\"}, LocationReport[data]]];\n\tplt
= \ Plot[{PDF[dist, r], PDF[dataDist, r], CDF[dist, r],
\n\t\tCDF[dataDist, r]}, \ {r, 0, xmax}, \n\t\tImageSize -> {400, 300},
Frame -> True, \n\t\tFrameLabel \ -> {\"r\", \"PDF, \\nCDF\", \"Rician
Distribution\", None}, \n\t\tPlotRange \ -> All, \n\t\tPlotStyle ->
{RGBColor[0, 0, 1], RGBColor[1, 0, 0]}];\n\t\
Print[StyleForm[Join[{\"Source\", dist}, LocationReport[dist]], \n\t\t\
FontColor -> RGBColor[0, 0, 1]]];\n\tPrint[StyleForm[Join[{\"Derived\",
\ dataDist}, \n\t\tLocationReport[dataDist]], FontColor -> RGBColor[1,
0, 0]]]\n\
];"], "Input"]
},
FrontEndVersion->"Macintosh 3.0",
ScreenRectangle->{{0, 1024}, {0, 748}}, AutoGeneratedPackage->None,
CellGrouping->Manual,
WindowSize->{721, 719},
WindowMargins->{{106, Automatic}, {Automatic, 3}}, ShowCellLabel->False,
MacintoshSystemPageSetup->"\<\
00<0001804P000000]P2:?oQon82n at 960dL5:0?l0080001804P000000]P2:001
0000I00000400`<300000BL?00400 at 0000000000000006P801T1T00000000000
00000000000000000000000000000000\>"
]


  • Prev by Date: Re: Linear Programming
  • Next by Date: Re: Cuboid & RotateShape
  • Previous by thread: Re: rician random number
  • Next by thread: Re: rician random number