![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178397/image.jpeg)
How to create a vector (or number?) with predefined mean and stdv (Standard deviation)?
7 ビュー (過去 30 日間)
古いコメントを表示
Hello, I would like to know how to create a vector (or number if possible)with predefined mean and std? Lets say that I need a vector with mean 13.8 and std 3.2.
Thanks.
0 件のコメント
採用された回答
Image Analyst
2015 年 9 月 16 日
Did you try randn()?
numSamples = 1000;
observations = 13.8 + 3.2 * randn(1, numSamples);
subplot(2,1,1);
plot(observations, 'b*');
grid on;
% Get histogram
[counts, edges] = histcounts(observations, 50);
subplot(2,1,2);
bar(edges(1:end-1), counts, 'BarWidth', 1, 'FaceColor', 'b');
grid on;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178397/image.jpeg)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!