フィルターのクリア

Plotting random numbers in histogram and bin allocation.

20 ビュー (過去 30 日間)
Joe Ainsworth
Joe Ainsworth 2021 年 9 月 5 日
コメント済み: KSSV 2021 年 9 月 7 日
Hi all
i have a set of 100 random numbers from 0-1, i need to plot these on a histogram and allocate them to 10 bins.
the program also needs to calculate mean and standard deviation.
i am unsure on how to do this on matlab and any help would be much appreciated.
here is the random number code i have currently.
Thanks !
clear all
clc
n = 100; % However many numbers you want.
randomNumbers = randi([0, 1], [1, n])
randomNumbers = int32(randi([0, 1], [1, n]));

採用された回答

KSSV
KSSV 2021 年 9 月 5 日
You have striaght away functions to achieve what you want. Read about histogram, mean, std.
  4 件のコメント
Joe Ainsworth
Joe Ainsworth 2021 年 9 月 5 日
Thanks @KSSV, if i wanted to change the range of this. say from 0-50 now how would i do so and then alter the amount of bins?
youre help is much appreciated.
KSSV
KSSV 2021 年 9 月 7 日
a = 0;
b = 50;
x = (b-a).*rand(1000,1) + a;
histogram(x)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by