Generation of triangle wave

版本 1.2.0.0 (101 字节) 作者: Michele Antolini
This function allows the generation of a triangular wave.
1.5K 次下载
更新时间 2014/10/27

查看许可证

The usage is the same as sin(2*pi*f*t), but the triangular wave is generated with an amplitude between 0 and 1.
So to generate one second of a triangle wave of amplitude 2 with frequency 5 Hz (sampled each millisecond)

f = 5;
t = 0:0.001:1;
A = 2;
wave = A*triangle(2*pi*f*t);

Note: the wave is generated with positive amplitude (i.e. centered around half of the amplitude). Check the comment in the code to easily change this behaviour.

引用格式

Michele Antolini (2024). Generation of triangle wave (https://www.mathworks.com/matlabcentral/fileexchange/46987-generation-of-triangle-wave), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.2.0.0

Changed title and description

1.1.0.0

new tags

1.0.0.0