フィルターのクリア

random uniform sample example

1 回表示 (過去 30 日間)
rathod ujjval rameshbhai
rathod ujjval rameshbhai 2015 年 8 月 31 日
コメント済み: Steven Lord 2015 年 8 月 31 日
I am trying to generate a function but there is an error
my code is
function X=Random_Uniform_Sample(number, dim, mins, maxs)
interval=repmat(maxs-mins, number, 1);
start=repmat(mins, number, 1);
X=interval.*rand(100,2)+start;
end
there is an error in dim. i define number=100; dim=2;mins[-1 3]; and maxs=[2 7];
  2 件のコメント
Walter Roberson
Walter Roberson 2015 年 8 月 31 日
I am not sure why you say there is an error in dim, considering that you do not use it in your code.
Steven Lord
Steven Lord 2015 年 8 月 31 日
Works fine when I run the lines inside your function with those variables defined. What is the FULL text of the error message you receive, and can you confirm that you call this function as:
X = Random_Uniform_Sample(100, 2, [-1 3], [2 7])
when you receive the error?

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by