reproducting a code( m-file)

hi This function will generate a normal distribution conditional by bounds:
http://www.mathworks.com/matlabcentral/fileexchange/23832-truncated-gaussian
i want to make this changes in above code>>>what should i do???in which line it should be???
sigma = 147.65; range = [450 800]; peakpos = 620;
[X meaneff sigmaeff] = TruncatedGaussian(-sigma, range-peakpos, [1 1e6]); X = peakpos+X; meaneff = peakpos+meaneff;
stdX=std(X); fprintf('mean(X)=%g, estimated=%g\n',meaneff, mean(X)) fprintf('sigma=%g, effective=%g, estimated=%g\n', sigma, sigmaeff, stdX) hist(X,64)

Réponses (1)

Walter Roberson
Walter Roberson le 4 Mar 2011

1 vote

I don't see anything in Bruno's code that would need to be changed. You are just calling Bruno's function, so just the lines you show into a .m file and run the file.

3 commentaires

Jan
Jan le 4 Mar 2011
Exactly. +1
milad babaei
milad babaei le 4 Mar 2011
be cause of this(want to generate a truncated bell shape where the peak of the pdf located at 620 (which is *NOT* the *mean*), and has the same *shape* as N(620,147.65) (the lastest parameter is *NOT* the standard deviation) i have to change it and on the other hand if i want to use this code under this condition would u plz help me??? this is my question:i have three variable c,g,fi that each of them has e relation like this(linear relation) q:F(c,g,fi)...so i need to use a for loop to provide the distribution of q. it means i want to generate 3 RV and then with that linear equationq:[F(c,g,fi)] generate q disribution.
milad babaei
milad babaei le 4 Mar 2011
this is all of my one variant:450,570,660,800.
i want to generate gaussian random number in this range [450 800]...mean:620
std:147.65...

Connectez-vous pour commenter.

Catégories

En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by