I'd like to create a periodic triangular waveform (0-1) with period = T.
How can I do that in Matlab?
Thanx a lot.
Waldir
Off the top of my head, I would use the integral (or cumulative sum) of a
square wave that's center around zero.
Scott
Can't you use mod(x/T,1) or something?
Try this:
T=20;
x=linspace(0,5*T,1000);
y1=min(0.5,mod(x,T)/T);
y2=min(0.5,1-mod(x,T)/T);
plot(x,y1+y2)
Andreas
TRIPULS Sampled aperiodic triangle generator.
TRIPULS(T) generates samples of a continuous, aperiodic,
unity-height triangle at the points specified in array T, centered
about T=0. By default, the triangle is symmetric and has width 1.
TRIPULS(T,W) generates a triangle of width W.
TRIPULS(T,W,S) allows the triangle skew S to be adjusted. The
skew parameter must be in the range -1 < S < +1, where 0 generates
a symmetric triangle.
See also SQUARE, SIN, COS, CHIRP, DIRIC, GAUSPULS, PULSTRAN and
RECTPULS.
ts=2E-3;
f=1000;
t=[0:ts/1000:ts];
sgn=sign (sin(2*3.14159*f*t));
m=2*f;
n=[0:1/f:ts];
y=(m*sgn*t)+(n*1/f);
plot (t,y)