Code covered by the BSD License

### Highlights from probability distribution function (normal distribution)

4.0
4.0 | 1 rating Rate this file 10 Downloads (last 30 days) File Size: 1.63 KB File ID: #23978 Version: 1.2

# probability distribution function (normal distribution)

### Sherif Omran (view profile)

02 May 2009 (Updated )

This function calculates the probability under the normal distribution curve

File Information
Description

This function calculates the probability under the normal distribution curve, plots the graph and the area calculated.

%Normaldistribution
%
% calculating the area under a normal distribution curve
% from -ve infinity upto point x.
%
% Input:
% x : point on the normal distribution curve
% mean : mean of the normal distribution curve
% sigma : standard deviation of the normal distribution curve
% (hint: normal dist mean=0, sigma=1)
% plotting: Plot the calculated area if plotting = 1
% Output: area under the curve.
%
% Example:
% x=[-20:20] % your data points
% sigma=length(x)/2/3.5 % PDF width is 3.5 sigma
% mean=0 % mean between -20 and 20
% normaldistribution(0, mean, sigma,1) % Calculate area from -inf to 0
%
%
% Author:
% Sherif Omran
% University and university hospital of Zurich
% Date: May 2009
% Part of my phd thesis:
% email: sherif.omran@gmx.de
%-------------------------------------------------------------------------%

MATLAB release MATLAB 7.6 (R2008a)
13 Jan 2010 ss grandite

### ss grandite (view profile)

This is a cdf (cumulative density function), actually. If you need better than 2 decimel places of accuracy, you can increase the resolution manually.

Comment only
13 Jul 2009 cabrego

### cabrego (view profile)

The shaded area in the function input below appears to be a little buggy, is that correct?

normaldistribution(.8686,1.02,.0829,1)

19 Jun 2009 Sherif Omran

### Sherif Omran (view profile)

I made an example to use my code. Assume you have a distribution from -20 to 20 with mean at 0, and you want to calculate the area from -inf to 0

Example:
sigma=length(x)/2/3.5 % standard div. normal dist. with is 3.5
mean=0 % mean of distribution
normaldistribution(0, mean, sigma,1)

Comment only