Creating a Normal Probability Curve

4 vues (au cours des 30 derniers jours)
Georgios Vamvakopoulos
Georgios Vamvakopoulos le 11 Août 2016
Hello,
I have a problem. I want to create a probability density function for a distribution. Initialy the only known values were the maximum and the minimum 95th percentile of the distribution. With maximum at 1.5 and minimum 0.66.
Using these values I calculated the mu = 1.08 and sigma = 0.24, based on 0.66 = mu - 2*sigma and 1.5 = mu +2*sigma But the problem is that whenever I insert the code in Matlab the probability density function graph is going over 1
This is my code
% Drag Coefficient
mu = 1.08;
sigma = 0.24;
x = (mu - 5 * sigma) : (sigma / 100) : (mu + 5 * sigma);
pdfNormal = normpdf(x, mu, sigma);
string = 'the maximal pdfNormal is';
string = sprintf('%s :%d', string,max(pdfNormal));
disp(string)
plot(x, pdfNormal);
Thank you in advance for your reply :)
  3 commentaires
Georgios Vamvakopoulos
Georgios Vamvakopoulos le 11 Août 2016
Sorry I was wrong. My actual problem is that I want to get the probability distribution from pdf. Can I do that using the above information?
Torsten
Torsten le 11 Août 2016
You mean
normcdf(x,mu,sigma)
?
Best wishes
Torsten.

Connectez-vous pour commenter.

Réponse acceptée

the cyclist
the cyclist le 11 Août 2016
Modifié(e) : the cyclist le 11 Août 2016
% Upper and lower limit of confidence interval defined by user
ci_hi = 1.5;
ci_lo = 0.66;
% Center of confidence interval
ci_center = (ci_hi + ci_lo)/2
% Function that needs to be minimized to meet the above criteria
f = @(sigma) (norminv(0.025,ci_center,sigma)-0.66).^2 + (norminv(0.975,ci_center,sigma)-1.5).^2;
% Find the minimum
[sigma_min,f_min] = fminsearch(f,1);
% Choose some values of x to illustrate
x = [-1 0 0.66 1.5 2 3]
x_pdf = normpdf(x,ci_center,sigma_min)
x_cdf = normcdf(x,ci_center,sigma_min)
% Plot a range
figure
x_range = -1 : 0.01 : 3;
subplot(2,1,1), plot(x_range,normpdf(x_range,ci_center,sigma_min))
subplot(2,1,2), plot(x_range,normcdf(x_range,ci_center,sigma_min))
Notice that the pdf is sometimes greater than 1, which I'm guessing you believe is a problem. But the pdf is not the probability. (This is a very common misconception.)
It is the integral of pdf(x) * dx that gives the probability of an event in the range dx. So, pdf(x) can be greater than one, over sufficiently small ranges of x.
  1 commentaire
Georgios Vamvakopoulos
Georgios Vamvakopoulos le 11 Août 2016
Thank you very much :)

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by