Posted By

Feb30th1712 on 01/28/08


Tagged

Value matlab gnu Octave expected


Versions (?)

統一發票期望值


 / Published in: MatLab
 

期望值為0.97018

  1. % A=[2000000 200000 40000 10000 4000 1000 200];x=[0 0:1:5]';p=@(n) (10.^n-10.^(n-1).*(1- (1/10).^n)/(1-1/10))*3/10^8;x=p(x);x(1)=x(1)/3;A*x
  2.  
  3. A=[2000000 200000 40000 10000 4000 1000 200];
  4. x=[0 0:1:5]';
  5. p=@(n) (10 .^ n - 10 .^ (n - 1) .* (1 - (1 / 10) .^ n) / (1 - 1 / 10)) * 3 / 10 ^8
  6. x=p(x);
  7. x(1)=x(1)/3;
  8. A*x
  9. % ans = 0.97018

Report this snippet  

You need to login to post a comment.