sawtooth
锯齿波或三角波
说明
示例
50 Hz 锯齿波
生成 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)
50 Hz 三角波
生成 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
绘制该波的功率谱。
pspectrum(x,fs,'Leakage',0.91)
输入参数
t
— 时间数组
向量 | 矩阵 | N 维数组
时间数组,指定为向量、矩阵或 N 维数组。sawtooth
沿大小大于 1 的数组 t
的第一个维度进行运算。
数据类型: double
xmax
— 波的最大值位置
1 (默认) | 介于 0 与 1 之间的标量
波的最大值位置,指定为 0 与 1 之间的标量。xmax
确定波达到最大值时介于 0 与 2π 之间的点。该函数在 0 到 2π×xmax
区间上从 -1 增加到 1,然后在 2π×xmax
到 2π 区间上从 1 线性减少到 -1。然后,该形状以 2π 为周期进行重复。
示例: xmax = 0.5
指定标准三角波,关于时间 π 对称,峰间幅值为 1。
数据类型: double
输出参数
x
— 锯齿波
向量 | 矩阵 | N 维数组
锯齿波,以向量、矩阵或 N 维数组形式返回。
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
版本历史记录
在 R2006a 之前推出
MATLAB 命令
您点击的链接对应于以下 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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)