フィルターのクリア

how to create an array(1 by 5000) having random values in the range(9-11).

3 ビュー (過去 30 日間)
sanky kumar
sanky kumar 2013 年 9 月 10 日
i have to put the array value as input for sine function, but i guess there are certain limitations for that. it would be great if you could help P.S: new to matlab excuse my immaturity.

採用された回答

Image Analyst
Image Analyst 2013 年 9 月 10 日
編集済み: Image Analyst 2013 年 9 月 10 日
Did you look in the help? It's example 1:
Example 1
Generate values from the uniform distribution on the interval [a, b]:
r = a + (b-a).*rand(100,1);
just change 100,1 to 1,5000, and change a to 9 and b to 11, like this:
r = 9 + 2 .* rand(1,5000);
By the way, what does "in sine" mean?
  2 件のコメント
sanky kumar
sanky kumar 2013 年 9 月 10 日
i have to put the array value as input for sine function, but i guess there are certain limitations for that. it would be great if you could help P.S: new to matlab excuse my immaturity.
Image Analyst
Image Analyst 2013 年 9 月 10 日
編集済み: Image Analyst 2013 年 9 月 10 日
I don't know if you mean that you want the random values to be the angle input to the sine,
out = sin(r);
or if you want to add those values to the sine wave:
x = linspace(0, 4*pi, length(r)); % Define angles.
noisy_y = amplitude * sin(x) + r;

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

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 10 日
9+rand(1,5000)*2

カテゴリ

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