Generation of triangle wave
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.
Citar como
Michele Antolini (2024). Generation of triangle wave (https://www.mathworks.com/matlabcentral/fileexchange/46987-generation-of-triangle-wave), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Agradecimientos
Inspiración para: Generation of Square,Triangular & Trapezoidal wave in MATLAB, triangleWave( time, amplitude, waveL, phaseShift)
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.