フィルターのクリア

histogram for gaussian distribution.

23 ビュー (過去 30 日間)
maulik bhagat
maulik bhagat 2022 年 9 月 2 日
編集済み: Chunru 2022 年 9 月 2 日
Generate an array of length N where each array element is a sample from a Gaussian
distribution with mean 0 and variance 1. Use the Matlab command histogram to plot
the histogram of these numbers. Vary N = 50, 100, 2000 to observe the difference
in the histogram. Change the variance to 0.25, 2, 5 for N = 2000 and observe the
difference in the histogram.
i have made the code but it is wrong.
N = input("value : ")
data = randn(N);
a = 1;% standard deviation
b = 0; % mean
out = a.*data + b;
hist(out)

回答 (1 件)

Chunru
Chunru 2022 年 9 月 2 日
編集済み: Chunru 2022 年 9 月 2 日
% N = input("value : ")
N = 2000;
data = randn(N, 1); % randn(N) => NxN
a = 1;% standard deviation
b = 0; % mean
out = a.*data + b;
histogram(out, 'Normalization', 'pdf')

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by