Creating vector using rand() function in a range

5 ビュー (過去 30 日間)
aliza mustafa
aliza mustafa 2022 年 8 月 18 日
コメント済み: aliza mustafa 2022 年 8 月 18 日
Hi,
Can you please help me how to generate a (1x10) vector using rand() function, with values between (0,7)? I got to do it with randi() function like this:
A = randi([0 7],1,10)
But I want to do it with rand() function instead of randi(). Any help will be really apprecited. Thanks

採用された回答

Matt J
Matt J 2022 年 8 月 18 日
A=7*rand(1,10)

その他の回答 (1 件)

Chunru
Chunru 2022 年 8 月 18 日
A = rand(1,10)*7
A = 1×10
6.8384 4.0485 1.2227 4.6696 1.2200 5.0852 5.7497 1.3552 6.3762 0.8102

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by