1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating variance- matlab discrepancy

  1. Jan 26, 2008 #1
    I am summarizing the problem that I have:

    Problem Description
    Given a model with 5 states [0 0 0 0 3] and with probabilities (1/3, 1/5, 1/5, 1/5, 1/15) find the variance.

    Solution

    I think I am calculating it properly but I am getting a different answer than MATLAB.

    Var = E(x^2) - E(x)^2

    Calculate E(x^2)
    P1X1^2 + P2X2^2 + P3X3^2 + P4X4^2 + P5X^2 =
    1/3(0) + 1/5(0) + 1/5(0) + 1/5(0) + 1/15(9) = 9/15

    Calculate E(x)^2
    (P1X1 + P2X2 + P3X3 + P4X4 + P5X5)^2 =
    (1/15(3))^2 = (3/15)^2 = 9/225

    Therefore variance is 9/15 - 9/225 = 0.5600

    However, MATLAB gives me 1.8.
    Who is right?

    Thanks

    Asif
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Calculating variance- matlab discrepancy
Loading...