Creating a sawtooth wave of width in Matlab

Version 1.0.0 (1.14 KB) by Aqeel Ahmed
This code is short and summarized to create triangular wave in matlab
26 Downloads
Updated 3 May 2020

View License

clc , clear all , close all
t = 0:1:100; % time
A = 1; % amplitude
f = 22.5; % frequency
W = 2; % width
y = A*sawtooth (2* pi*f*t,W);
stem(t,y)
axis ([0 100 -3 3])
xlabel ('Time in seconds ')
ylabel ('Amplitude ')
title ('Triangular Wave')
grid

Cite As

Aqeel Ahmed (2026). Creating a sawtooth wave of width in Matlab (https://www.mathworks.com/matlabcentral/fileexchange/75336-creating-a-sawtooth-wave-of-width-in-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0.0