Documentation

std2

Standard deviation of matrix elements

Syntax

B = std2(A)

Description

example

B= std2(A)computes the standard deviation of all values in arrayA.

You optionally can compute the standard deviation using a GPU (requires Parallel Computing Toolbox™). For more information, seeImage Processing on a GPU.

Examples

collapse all

Read a grayscale image into the workspace, then calculate the standard deviation of the pixel intensity values.

I = imread('liftingbody.png'); val = std2(I)
val = 31.6897

Read a grayscale image into the workspace as agpuArrayobject, then calculate the standard deviation of the pixel intensity values using a GPU.

I = gpuArray(imread('liftingbody.png')); val = std2(I)

Input Arguments

collapse all

Input data, specified as a numeric or logical array.

To perform the computation on a GPU, specifyAas agpuArraythat contains a numeric or logical array.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|logical

Output Arguments

collapse all

Standard deviation of input data, returned as a numeric scalar. If the data type ofAissingle, then the data type ofBis also single. Otherwise, the data type ofBisdouble.

If the standard deviation is computed on a GPU, thenBis returned as agpuArraycontaining a numeric scalar.

Data Types:single|double

See Also

|||

Introduced before R2006a

Was this topic helpful?