- for loop is unnecessary;
- Wrong way to index matrix u;
- t1 is unnecessary cause t1 have the same probability distributions with u;
loop with uniform distribution
2 ビュー (過去 30 日間)
古いコメントを表示
Hi
Let u(i) is uniform distribution in (0,1), with size (1 column contain 10 number), and the values of u(i) is different in every loop.since the values of u(i) is random uniform distribution will take any values in (0,1).
I want
the RESULT of t3 must contain 15 column ,and every column contain 10 number, with the values of u(i) is different in every i=1:15
this is my try ,what I change to get the above RESULT.
thanks a lot for any help.
sz = [10 1];
a=1.778;
for i=1:15
u(i) = unifrnd(0,1,sz)
t1=1 - u(i);
t2=t1/a;
t3=exp(t2);
end
t3
0 件のコメント
採用された回答
weikang zhao
2021 年 2 月 4 日
you can get t3 by:
t3=exp(unifrnd(0,1/1.778,10,15));
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!