First up, that not really a square wave, a square wave should have equal low time as high time, or a least a constant duty cycle.
you wave is low for 30, high for 30 and then low for 40? are you sure this is what you want?
the typical way to generate real square waves is something like:
Code:
x = 0:0.1:100;
y = double((mod(x,60) > 30));
plot(x,y);
what this does is takes the modulus (i.e. the remainder) from 60 and check if its greater than 30. since a greater than check returns a boolean (1 or 0) result, the double() casts the number back into a 'normal' matlab number...