Main Content

sin

参量的正弦,以弧度为单位

说明

示例

Y = sin(X) 返回 X 的元素的正弦。sin 函数按元素处理数组。该函数同时接受实数和复数输入。

  • 对于 X 的实数值,sin(X) 返回区间 [-1, 1] 内的实数值。

  • 对于 X 的复数值,sin(X) 返回复数值。

示例

全部折叠

在域 -πxπ 上绘制正弦函数图。

x = -pi:0.01:pi;
plot(x,sin(x)), grid on

计算复角在向量 x 中的正弦。

x = [-i pi+i*pi/2 -1+i*4];
y = sin(x)
y = 1×3 complex

   0.0000 - 1.1752i   0.0000 - 2.3013i -22.9791 +14.7448i

输入参数

全部折叠

以弧度为单位的输入角度,指定为标量、向量、矩阵、多维数组、表或时间表。

数据类型: single | double | table | timetable
复数支持:

输出参量

全部折叠

输入角的正弦,以实数值或复数值标量、向量、矩阵或多维数组、表或时间表形式返回。

详细信息

全部折叠

正弦函数

通过引用直角三角形定义的角的正弦 α 是

sin(α)=opposite sidehypotenuse=ah.

Right triangle with vertices A, B, and C. The vertex A has an angle α, and the vertex C has a right angle. The hypotenuse, or side AB, is labeled as h. The opposite side of α, or side BC, is labeled as a. The adjacent side of α, or side AC, is labeled as b. The sine of α is defined as the opposite side a divided by the hypotenuse h.

复数参量的正弦 α 是

sin(α)=eiαeiα2i.

提示

  • 要精确计算 sin(X*pi) 而不使用 pi 作为 π 的浮点近似值,您可以改用 sinpi 函数。例如,对于整数 nsinpi(n) 精确为零;对于奇数 msinpi(m/2) 为 +1 或 -1。

扩展功能

C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。

GPU 代码生成
使用 GPU Coder™ 为 NVIDIA® GPU 生成 CUDA® 代码。

版本历史记录

在 R2006a 之前推出

全部展开

另请参阅

| | | |