Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The mean is A*B. So can you solve for perhaps A in terms of the mean(mu) and B?</p> <pre><code>A = mu/B </code></pre> <p>Of course, this does no good unless you knew B. Or does it?</p> <p>Look at your first expression. Can you substitute?</p> <pre><code>gamcdf(2.11, mu/B, B) - gamcdf(1.61, mu/B, B) = 0.90 </code></pre> <p>Does this get you any closer? Perhaps. There will be no useful symbolic solution available, except in terms of the incomplete gamma function itself. How do you solve a single equation numerically in one unknown in matlab? Use fzero.</p> <p>Of course, fzero looks for a zero value. But by subtracting 0.90, that is resolved.</p> <p>Can we define a function that fzero can use? Use a function handle.</p> <pre><code>&gt;&gt; mu = 1.86; &gt;&gt; gamfun = @(B) gamcdf(2.11, mu/B, B) - gamcdf(1.61, mu/B, B) - 0.90; </code></pre> <p>So try it. Before we do that, I always recommend plotting things.</p> <pre><code>&gt;&gt; ezplot(gamfun) </code></pre> <p>Hmm. That plot suggests that it might be difficult to find a zero of your function. If you do try it, you will find that good starting values for fzero are necessary here.</p> <p>Sorry about my first try. Better starting values for fzero, plus some more plotting does give a gamma distribution that yields the desired shape.</p> <pre><code>&gt;&gt; B = fzero(gamfun,[.0000001,.1]) B = 0.0124760672290871 &gt;&gt; A = mu/B A = 149.085442218805 &gt;&gt; ezplot(@(x) gampdf(x,A,B)) </code></pre> <p>In fact this is a very "normal", i.e, Gaussian, looking curve.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload