generating random samples in simulink with dynamic mean and variance

조회 수: 4 (최근 30일)
pemfir
pemfir 2013년 7월 22일
Hello and thanks for reading. suppose i want to generate random samples from a normal distributions, but the mean and variance of the distribution are determined/calculated in each iteration of the simulation and change with time.
so i want a block which takes as inputs (mean, variance) and spits out (random number from a normal distribution with that mean and variance).
Thank you !
  댓글 수: 3
pemfir
pemfir 2013년 7월 22일
Thank you, i think your hint helped me figure it out. I should set a random number block with mean 0 and variance 1 (i.e., x~N(0,1)), then calculate the desired mean and variance using a matlab function block, then add the mean and multiply the root of the variance to the each random number generated from the random block to achieve the desired mean and variance. if x~N(0,1) then ax + b ~ N(b,a^2), where a and b are calculated in the matlab function block.
dpb
dpb 2013년 7월 22일
Yes. I've never used Simulink so I was presuming the parameters could be inputs from upstream blocks but I guess on re-reading the doc they're fixed parameters so your option is to scale the standardized z-value downstream instead. Same result, different way to get it.

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by