avoid imaginary numbers in probabilistic calculation

1 view (last 30 days)
Aikaterini
Aikaterini on 8 Oct 2014
Commented: Star Strider on 8 Oct 2014
Hello everyone,
I am trying to do create a number given its probability dencity function. So, for example I have h=expinv(mu), where expinv is the inverse exponential function and I get imaginary values of h. How can I avoid them?
Thanks in advance
Katerina
  1 Comment
Aikaterini
Aikaterini on 8 Oct 2014
Dear all,
i am trying to run a Monte Carlo (MC) analysis in Matlab, so it is supposed that the probability is being provided automatically from the MC code that matlab has. What someone has to do at first is to determine the probability density functions of each parameter in order to get a sample of values from MC. In this point I have negative and even imaginary values which are undesirable. Do you know what to do in this case? Does anyone know aboout MC simulation in Matlab?
Regards, Katerina

Sign in to comment.

Answers (2)

Mike Hosea
Mike Hosea on 8 Oct 2014
You haven't told me how you got them, so I can't tell you how to avoid them. Most likely your calculations before calling expinv are returning complex numbers. Note that the first argument to expinv is a probability value, not the mean. The mean is the optional second input.

Star Strider
Star Strider on 8 Oct 2014
You have to provide both a probability value (0,1) and a value for mu for expinv. You are only giving it one parameter.
  5 Comments
Star Strider
Star Strider on 8 Oct 2014
I haven’t used help since the Help browser appeared a few releases ago. It never occurred to me to look at help.
I agree with the rest.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!