MATLAB: How to draw 2D periodic triangular signal

triangle

w=1; % signal width
Amp=1; % signal amplitude
tt=-w:w;
y1=Amp-Amp*abs(tt)/w;
figure;
plot(tt,y1)
is this is code is right??

Best Answer

Not yet. That is just one period, not a waveform with multiple periods. Use repmat() to make more of them.