The following Matlab project contains the source code and Matlab examples used for generation of triangular 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
function y = triangle(t)
y = abs(mod((t+pi)/pi, 2)-1);
This can be easily modified to be between -1 and 1:
function y = triangle(t)
y = abs(mod((t+pi)/pi, 2)-1)*2-1;
.

The source code and files included in this project are listed in the project files section, please make sure whether the listed source code meet your needs there.

## Project Files:

File Name | Size |
---|---|

license.txt | 1316 |

triangle.m | 101 |