# qfunc

Q function

## Syntax

`y = qfunc(x)`

## Description

`y = qfunc(x)` is one minus the cumulative distribution function of the standardized normal random variable, evaluated at each element of the real array `x`. For a scalar `x`, the formula is

$Q\left(x\right)=\frac{1}{\sqrt{2\pi }}\underset{x}{\overset{\infty }{\int }}\mathrm{exp}\left(-{t}^{2}/2\right)dt$

The Q function is related to the complementary error function, erfc, according to

$Q\left(x\right)=\frac{1}{2}\text{erfc}\left(\frac{x}{\sqrt{2}}\right)$

## Examples

The example below computes the Q function on a matrix, element by element.

```x = [0 1 2; 3 4 5]; format short e % Switch to floating point format for displays. y = qfunc(x) format % Return to default format for displays.```

The output is below.

```y = 5.0000e-001 1.5866e-001 2.2750e-002 1.3499e-003 3.1671e-005 2.8665e-007 ```