主要内容

Sine, Cosine

Implement fixed-point sine or cosine wave using lookup table approach that exploits quarter wave symmetry

  • 库:
  • Simulink / Lookup Tables

  • Sine block
  • Sine block

Description

The Sine and Cosine block implements a sine and/or cosine wave in fixed point using a lookup table method that exploits quarter wave symmetry. The block can output the following functions of the input signal, depending upon what you select for the输出公式parameter:

  • sin(2πu)

  • cos(2πu)

  • exp(ju)

  • sin(2πu) and cos(2πu)

You define the number of lookup table points in the查找表的数据点数parameter. The block implementation is most efficient when you specify the lookup table data points to be(2^n)+1, wherenis an integer.

Use theOutput word lengthparameter to specify the word length of the fixed-point output data type. The fraction length of the output is the output word length minus 2.

端口

输入

expand all

输入信号U,指定为实值标量,向量或矩阵。

Tip

为了获得有意义的块输出,块输入值应落在[0,1)的范围内。对于落在此范围之外的输入值,将这些值投入到无符号数据类型中,其中包含包装。对于这些范围内输入,块输出可能没有意义。

Data Types:single|double|int8|INT16|INT32|int64|uint8|UINT16|uint32|uint64|Boolean|固定点

Output

expand all

Fixed-point sine wave, implemented using a lookup table approach.

Dependencies

This port is enabled when the输出公式被设定为罪(2*pi*u)或者罪(2*pi*u)和cos(2*pi*u)

Data Types:固定点

Fixed-point cosine wave, implemented using a lookup table approach.

Dependencies

This port is enabled when the输出公式被设定为cos(2*pi*u)或者罪(2*pi*u)和cos(2*pi*u)

Data Types:固定点

exp(j*2*pi*u), implemented using a lookup table approach.

Dependencies

This port is enabled when the输出公式被设定为exp(j*2*pi*u)

Data Types:固定点

Parameters

expand all

Programmatic Use

块参数:公式
Values:'sin(2*pi*u)' | 'cos(2*pi*u)' | 'exp(j*2*pi*u)' | 'sin(2*pi*u) and cos(2*pi*u)'

The implementation is most efficient when you specify the lookup table data points to be(2^n)+1, wherenis an integer. To be compatible with theOutput word lengthparameter, the查找表的数据点数must be less than or equal to(2 ^ (Output word length-2)+1)

Programmatic Use

块参数:NumDataPoints
Type:scalar
Value:整数>= 2
Default:'(2^5)+1'

输出的分数长度为输出单词长度负2。要与查找表的数据点数parameter,(2 ^ (Output word length-2)+1)must be greater than or equal to查找表的数据点数

Note

The block uses double-precision floating-point values to construct lookup tables. Therefore, the maximum amount of precision you can achieve in your output is 53 bits. Setting the word length to values greater than 53 bits does not improve the precision of your output.

Programmatic Use

块参数:outputwordlength
Type:scalar
Value:整数from 2 to 53
Default:'16'

SelectSpeed用于更快的计算。如果这样做,可能会丢失准确性,通常最多2位。

Programmatic Use

块参数:InternalRulePriority
Values:'Speed' | 'Precision'
Default:'Speed'

块特征

Data Types

Boolean|double|固定点|整数|single

直接进料

Multidimensional Signals

Variable-Size Signals

Zero-Crossing Detection

Extended Capabilities

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

Fixed-Point Conversion
使用定点Designer™设计和模拟定点系统。

Version History

在R2006a之前引入