Is this correct the correct code for this? Suppose Xi for i=1, 2, 3… has Uniform(0,1) distribution..

1 回表示 (過去 30 日間)
Suppose Xi for i=1, 2, 3… has Uniform(0,1) distribution. Let N = min (n+1: Xn > Xn+1). Find E (N) by simulation. 10,000 simulations required.
For the first part I think this is :
S1 = symsum(x, x, 2, inf); %Summation for Xi for i = 2,3,4...
a = 1; %beta distrubtion Uniform(0,1) distribution with a=1 & b=1
b = 1;
data = S1(a,b); %Xi has Uniform(0,1) distribution
N = (S1) > (S1+1) % setting N
if this is correct then i'm only confused on finding E(N) here..
I was horribly off, thank you for the help here
  4 件のコメント
HrMmz
HrMmz 2016 年 12 月 5 日
Maybe I'll start another question and just ask if anyone can help understand what this means
John D'Errico
John D'Errico 2016 年 12 月 5 日
Asking the same question twice won't get you a better answer.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2016 年 12 月 5 日
Like John, I have no idea what "min (n+1: Xn > Xn+1)" means, but anyway, is this what you want?
numSimulations = 10; % or 10000
x = rand(1, numSimulations)
% Make "Xn > Xn+1" by sorting in descending order
x = sort(x, 'descend') % Now Xn > Xn+1 because we sorted it
% Generate a vector of (n+1) values.
nPlus1 = 2 : (length(x) + 1)
N = min([x; nPlus1], [], 1)
% Of course since all x are less than 2, N will equal x.
en = mean(N)
It's also unclear what the difference between n and i. Are they both simply indexes of the arrays? If so, why did you change notation??? Or does n mean something different than i?
  1 件のコメント
HrMmz
HrMmz 2016 年 12 月 5 日
編集済み: HrMmz 2016 年 12 月 5 日
Xi and Xn are the same here
thanks again for the help

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by