Question on Chebyshev filter
Allowing for differences between Matlab and Octave ( I only have Gnu Octave to play with,) and correcting the errors noted in the comments, I get the following:
Needed fixes:


Values for Wp and Ws divided by half of sampling rate - the cheb1ord function requires frequencies be given relative to the Nyquist frequency.
Removed 's' (not allowed for Octave anyway.)


To make the code work for Octave, I had to make the following changes:


Remove duty cycle value from square
Remove 's' from cheb1ord and cheby1


Code for Octave (should run under Matlab as well:)

%Making the square pulses
Fs = 1000000;
nyq=Fs/2;
t = 0:1/Fs:50e-4; 
f = 2000;

%square pulse with 50% duty cycle
xt = square(2*pi*f*t);

%Making the filter
Wp = [1000/nyq 3000/nyq]; 
Ws = [100/nyq 3900/nyq];
[n,Wn] = cheb1ord(Wp,Ws,3,20);
[b,a] = cheby1(n,3,Wn,'s');

%Filtering with the coefficients 
xt_filtered = filter(b,a,xt);

%Plotting the filtered signal
subplot (211);
plot(t,xt);
subplot(212);
plot(t,xt_filtered);