필터 지우기
필터 지우기

How to create a vector (or number?) with predefined mean and stdv (Standard deviation)?

조회 수: 5 (최근 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.

채택된 답변

Image Analyst
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;
  댓글 수: 1
Sergey Dukman
Sergey Dukman 2015년 9월 16일
Thank you. I have only one question left. What does this expression (1, numSamples) means?
Sergey

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by