How can I make a repeating rectangular wave with a specified period?

7 views (last 30 days)
Hello, this is my first post so I am hoping that my formating is okay. I need to plot a descrete rectangular wave 7 units wide and that repeats with a period of 35 units. I know how to make the intial signal using the rectangularPulse function but I am not sure how to go about repeat it with the desired period. I need to show a minimum of 4 full cycles. Any help would be greatly appreciated.
n = -20:20;
y = rectangularPulse(-3.5,3.5,n);
stem(n,y);

Answers (1)

KSSV
KSSV on 11 Mar 2019
n = -20:20;
y = rectangularPulse(-3.5,3.5,n);
y1 = repmat(y,1,4) ;
n1 = 1:length(y1) ;
stem(n1,y1);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!