I want to plot a square wave centered around the Y-axis.
Kshitij Singh answered .
2025-11-20
t = -0.5:0.01:0.5; y = square(2*pi*.25*t,100); plot(t,y) tl = -1:0.01:-0.5; yl = square(0*pi*.25*tl,0); tr = 0.5:0.01:1; yr = square(0*pi*.25*tl,0); tg = [tl t tr]; yg = [yl y yr]; plot(tg,yg)