This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Sine of fixed-point values


y = sin(theta)


y = sin(theta) returns the sine of fi input theta using a table-lookup algorithm.

Input Arguments


theta can be a real-valued, signed or unsigned scalar, vector, matrix, or N-dimensional array containing the fixed-point angle values in radians. Valid data types of theta are:

  • fi single

  • fi double

  • fi fixed-point with binary point scaling

  • fi scaled double with binary point scaling

Output Arguments


y is the sine of theta. y is a signed, fixed-point number in the range [-1,1]. It has a 16-bit word length and 15-bit fraction length (numerictype(1,16,15)) .


Calculate the sine of fixed-point input values.

theta = fi([-pi/2,-pi/3,-pi/4 0, pi/4,pi/3,pi/2])

theta =
theta =
   -1.5708  -1.0472  -0.7854  0  0.7854  1.0472  1.5708

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 14  

y = sin(theta)
y =
   -1.0000  -0.8661  -0.7072   0  0.7070  0.8659  0.9999

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

More About

collapse all


The sine of angle Θ is defined as



collapse all

The sin function computes the sine of fixed-point input using an 8-bit lookup table as follows:

  1. Perform a modulo 2π, so the input is in the range [0,2π) radians.

  2. Cast the input to a 16-bit stored integer value, using the 16 most-significant bits.

  3. Compute the table index, based on the 16-bit stored integer value, normalized to the full uint16 range.

  4. Use the 8 most-significant bits to obtain the first value from the table.

  5. Use the next-greater table value as the second value.

  6. Use the 8 least-significant bits to interpolate between the first and second values, using nearest-neighbor linear interpolation.

fimath Propagation Rules

The sin function ignores and discards any fimath attached to the input, theta. The output, y, is always associated with the default fimath.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2012a

Was this topic helpful?