Code covered by the BSD License  

Highlights from
Q Function

3.2

3.2 | 5 ratings Rate this file 11 Downloads (last 30 days) File Size: 1.02 KB File ID: #7920

Q Function

by Timothy Felty

 

26 Jun 2005 (Updated 28 Jun 2005)

The Q Function implemented as integegraion of density function.

| Watch this File

File Information
Description

This function computes the Q function by integrating the Normal distribution.

It takes one paramter and calculates the right tail probablity.
Ex. x=q(0)
x would have the value of .5

For an arbitrary Gaussian distribution with mean, mu, and variance, sigma^2, then the function is passed this form.
((y-mu)/sigma)

Ex. Say you have a distribution of G(3,4). mu = 3, and sigma = 2. You want to calculate the right tail probability that it will be greater than 3.5. The function call would look like
answer=q((3.5-3)/2);

This is not the most efficient way of calculating this. I wrote this because I didn't have the proper toolbox. If you have the toolbox its just QFunc.

MATLAB release MATLAB 6.5 (R13)
Other requirements As far as I know there are no known requirements other than having Matlab installed. I have only tested this on R13 though.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
29 Jun 2005 carlos lopez

Probably it would be nice to have a definition of the Q function. Some other submissions suffer from the same problem: the authors are so inmersed in their own field that it is difficult to an outsider to take advantage of the submissions.

03 Jul 2005 Tim Felty

Sorry about that. It calculates the tail end probability of a Gaussain distribution. It calculates the area from a point x on the distribution to infinity, giving the probability.

06 Jan 2006 TJ Lim

The Q function is related to the complementary error function, which is available in Matlab as erfc, so qx = erfc(x/sqrt(2))/2 yields Q(x) without explicit integration.

06 Nov 2006 Abhimanyu Sharma  
22 Nov 2006 k dg

good !

01 May 2007 M P

Thanks Timothy and TJ

22 May 2007 Jerry Chiang

why not simply use built-in ERF function?

function answer = q(x)
answer = 1/2*(1-erf(x/sqrt(2)));

29 Oct 2011 Stephen

This function was needed for a Satellite COmmunictation class. I had to have Q(x), not erf(x). I tested it today on Matlab R2009a and it works. Thanks Mr. Felty!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Timothy Felty 22 Oct 2008 07:51:22
probability Timothy Felty 22 Oct 2008 07:51:22
q function Timothy Felty 22 Oct 2008 07:51:22
probability theory Timothy Felty 22 Oct 2008 07:51:22
qx probability Muhammad Usman 22 Feb 2010 14:57:04

Contact us at files@mathworks.com