How to filter my noisy square wave so that i can recover my signal using the Chebyshev Filter I have a noisy square signal as input but it has a lot of noise.
I should use a Bandpass filter to recover my signal.
I know that the Chebyshev Filter is a bandpass filter; but it doesn't work. the data is still noisy after filtering.

Chebyshev Filter:
The Chebyshev filter  gives a sharper cutoff than a Butterworth filter in the pass band. A disadvantage of the Chebyshev filter is the exterior of gain minima and maxima below the cutoff frequency. Due to the ripples in the pass-band, it is not used in the audio systems. Though it is far better in some applications where there is only one frequency available in the pass band, but numerous other frequencies are required to eliminate.

 % I use A picoscope2000 serie for data acquisition. (MATLAB)
 ps2000_getdata;  

 % The data is saved a cha_a (MATLAB)
 cha_a = (bufferChA/1000);
  
 % Here i use the Chebyshev bandpass filter to filter the noisy data(MATLAB) 
 [A,B,C,D] = cheby2(10,40,[900 1100]/1500);
 d = designfilt('bandpassiir','FilterOrder',20, ...
'StopbandFrequency1',900,'StopbandFrequency2',1100, ...
'StopbandAttenuation',40,'SampleRate',8000);

  y= filter(d,cha_a); % convolution

  sos = ss2sos(A,B,C,D);
  fvt = fvtool(d,y,'Fs',8000);
  legend(fvt,'cheby2','designfilt')

This is the result of the magnitude response :

And this is the impulse response :

My input data is suppose to be a squared data.
And when you look at the impulse response of the output, it does not look like the impulse response of a square signal. There is stil noise. How can i adjust my filter ? Or did i used the filter well ?
Bandpass filtering won't do what you're after.  If I take a noiseless square wave with the spectrum in red, and design a bandpass filter for it (response in blue):



and then apply this filter to the original (light blue) square wave, then I get the dark blue response.



I suspect that a better approach might be to use a median filter.

If I apply some gaussian noise to the square wave (blue line), and then apply a median filter (orange plot) then the result is below.



These plots were generated in python; I don't have easy access to Matlab. Code below.

from scipy import signal
import math
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0,20*math.pi,1000)
sq = scipy.signal.square(t)

b, a = signal.cheby1(4, 0.1, [0.01, 0.2], 'bandpass')

plt.rcParams['figure.figsize'] = [20, 10]
plt.figure(1)
w, h = signal.freqz(b, a)
w2, h2 = signal.freqz(sq, 1)
plt.plot(w, abs(h)*600)
plt.plot(w2, abs(h2), color='red')


plt.figure(2)
plt.rcParams['figure.figsize'] = [20, 10]
plt.plot(t,sq)
sq_f = scipy.signal.lfilter(b,a,sq)
plt.plot(t,sq_f,color='blue')

sq_noisy = sq + np.random.normal(0,1,1000)
plt.figure(3)
plt.plot(t,sq_noisy)
sq_noisy_f = scipy.signal.medfilt(sq_noisy,21)
plt.plot(t,sq_noisy_f,color='orange')