帮助中心帮助中心
锯齿波或三角波
x = sawtooth(t)
x = sawtooth(t,xmax)
示例
x = sawtooth(t) 为时间数组 t 的元素生成周期为 2π 的锯齿波。sawtooth 类似于正弦函数,但会创建峰值为 -1 和 1 的锯齿波。锯齿波定义为在 2π 的倍数处为 -1,而在所有其他时间处以斜率为 1/π 随时间呈现线性增加。
x
t
sawtooth
x = sawtooth(t,xmax) 生成修正三角波,其每个周期的最大值位置由 xmax 控制。将 xmax 设置为 0.5 可生成标准三角波。
xmax
0.5
全部折叠
生成 10 个周期的锯齿波,其基频为 50 Hz。采样率为 1 kHz。
T = 10*(1/50); fs = 1000; t = 0:1/fs:T-1/fs; x = sawtooth(2*pi*50*t); plot(t,x) grid on
绘制该波的功率谱。
pspectrum(x,fs,'Leakage',0.91)
生成 10 个周期的三角波,其基频为 50 Hz。采样率为 1 kHz。
T = 10*(1/50); fs = 1000; t = 0:1/fs:T-1/fs; x = sawtooth(2*pi*50*t,1/2); plot(t,x) grid on
时间数组,指定为向量、矩阵或 N 维数组。sawtooth 沿大小大于 1 的数组 t 的第一个维度进行运算。
数据类型: double
double
波的最大值位置,指定为 0 与 1 之间的标量。xmax 确定波达到最大值时介于 0 与 2π 之间的点。该函数在 0 到 2π×xmax 区间上从 -1 增加到 1,然后在 2π×xmax 到 2π 区间上从 1 线性减少到 -1。然后,该形状以 2π 为周期进行重复。
示例: xmax = 0.5 指定标准三角波,关于时间 π 对称,峰间振幅为 1。
xmax = 0.5
锯齿波,以向量、矩阵或 N 维数组形式返回。
在 R2006a 之前推出
chirp | cos | diric | gauspuls | pulstran | rectpuls | sin | square | tripuls
chirp
cos
diric
gauspuls
pulstran
rectpuls
sin
square
tripuls
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office