What function do I use to generate a matrix with the values in specific increments?

I understand how to use the 'linspace' function, but I was wondering if I'm able to do it using the 'randi' function, or the 'randm' function.

1 件のコメント

dpb
dpb 2015 年 2 月 15 日
What is "it" here, specifically?
If you control a randomized variate to have some specific spacing then it wouldn't be all that random. What's the actual objective?

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

回答 (2 件)

bharti patel
bharti patel 2015 年 2 月 15 日
編集済み: bharti patel 2015 年 2 月 15 日

0 投票

In order to create a matrix with specific increment, you can use something like: x = [0, 5, 200]; This will create a row vector, with values starting with zero, with increments of 5 and ending with 200.
using Randi; randi(10,3,4); This will create a 3 by 4 matrix with random numbers between 1 to 10.
There is no randm fucntion. Do you mean randn?
Roger Stafford
Roger Stafford 2015 年 2 月 16 日
I think you mean something like this:
incr = rand(1,n); % Variable increments
x = cumsum(incr); % Variable with 'incr' spaced intervals

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

タグ

質問済み:

2015 年 2 月 15 日

回答済み:

2015 年 2 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by