MATLAB: What is the problem in this code plz help

bandstopdspMATLAB

fs=8000;
dt=1/fs;
T=0.5;
t=0:dt:T-dt;
xt=cos(100*pi*t)-2*cos(50*pi*t);
rt=xt+cos(120*pi*t);
pa = bandstop(rt,[230 450],fs);
plot(t,pa);

Best Answer

For your second question: "write the function designfilt instead of bandstop":
B = designfilt('bandstopfir', 'SampleRate', 8000, ...
'PassbandFrequency1', 230, 'PassbandFrequency2', 450, ...
'StopBandFrequency1', 247.27, 'StopBandFrequency2', 432.73, ...
'StopbandAttenuation', 60, ...
'PassbandRipple1', 0.1, 'PassbandRipple2', 0.1, ...
'DesignMethod', 'kaiserwin');
Related Question