Set boundaries for norminv output
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marc Jakobi
am 27 Jul. 2015
Beantwortet: Torsten
am 27 Jul. 2015
Hi.
I am trying to generate randomized data with a certain average and a standard deviation. However, the data has to be within a realistic range.
My attempt so far has been as follows:
JV = norminv(rand(dim),4700,1500); %dim is the dimensions of the output
The problem with this method is that I have to manually limit the output:
JV(JV < 1000) = 1000;
JV(JV > 9000) = 9000;
The mean and standard deviation are still within an acceptable range. However, due to the manual limitation, the histogram shows sudden "jumps" in the amounts at the bins 1000 and 9000.
Is there a way I can set the boundaries within norminv, so that I get a "clean" histogram?
Thanks!
- Marc
UPDATE: I found a solution:
P1 = normcdf(1000,4700,1500);
P2 = normcdf(9000,4700,1500);
JV = norminv(P1+(P2-P1).*rand(dim),4700,1500);
This "cleans up" the histogram. But of course the standard deviation is slightly smaller than 1500, since a strictly gaussian distribution is not possible within a limited interval.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!