cospi

Computes cos(X * pi) accurately.

Syntax

  • res = cospi(x)

Input argument

  • x - a numeric value

Output argument

  • res - a numeric value

Description

res = cospi(x) computes cos(x * pi) accurately.

For integers, cospi(x) is +1 or -1.

For odd integers, cospi(x / 2) is exactly zero.

Example

x = [0, 1/2, 1, 3/2, 2];
r = cos(x * pi)
res = cospi(x)

See also

cos, sinpi.

History

VersionDescription

1.0.0

initial version

Author

Allan CORNET

Last updated