This is a slight variation on the method I showed you when you presented a similar problem yesterday in How to create a square wave pulse
t = linspace(0, 10E-3); % Time Vector (0 - 10ms)
f = 5/max(t); % Desired Frequency (Cycles/Timespan)
sqwv = sign(sin(2*pi*t*f)); % Signal
figure
plot(t, sqwv, 'LineWidth',1.5)
grid
ylim(ylim*1.1)
xlabel('Time (s)')
ylabel('Amplitude')
Only the frequency changes.