square() function does not adhere to duty cycle. The following code outputs waveforms with 50% and 60% duty cycle alternatively, while it should be 50%:
>> fs = 1200;
>> t = ((1:8192) – 1) / fs;
>> square(2 * pi * 120 * t, 50)
ans =
Columns 1 through 37
1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 -1 -1
Best Answer