フィルターのクリア

Create a two-point distribution?

6 ビュー (過去 30 日間)
kevin cecere palazzo
kevin cecere palazzo 2019 年 10 月 17 日
コメント済み: kevin cecere palazzo 2019 年 10 月 17 日
I want to multiply each element of a vector by a random variable X that takes values +1 and -1 with probability 1/2. How do I create this random variable?

回答 (1 件)

dk
dk 2019 年 10 月 17 日
N=100;
x=sign(rand(N,1)-0.5);
  1 件のコメント
kevin cecere palazzo
kevin cecere palazzo 2019 年 10 月 17 日
probability of getting sign(0)?

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

Community Treasure Hunt

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

Start Hunting!

Translated by