MATLAB: Hello everyone, I have this question. Any help in appreciated. ^_^

single square wave

Building a square wave. It is defined as f(t) = {1 if 0 < t < T, -1 if –T < t < 0}.
a. Create a script that plots a single square wave. Label the graph.
b. Change the above script to include a train of square waves consisting of 4 squares pieces.

Best Answer

Try repmat() or repelem(), or use the square() function.