MATLAB: Cut-off frequency not reached with the equiripple-filter

equiripple-filterfilterdesignfir filter

Hi, I am new to filter design and I have designed an equiripple filter in matlab using the commands:
Hd=fdesign.lowpass('Fp,Fst,Ap,Ast',30000000,50000000,1,60,1000000000);
d=design(Hd,'equiripple');
With a passband frequency of 30MHz and a stopband frequency of 50MHz. However, when I filter the signal
x=1:100000;
y=2+sin(1000*x)+5*sin(1*10^9*x);
with the command
h=filter(d,y);
both sine-functions are reduced. But sin(100*x) should go through and I don't understand why it doesn't. Does anyone know what I am doing wrong?
Thanks Jenny

Best Answer

Hi Jenny, you don't tell me what Fs is here so I cannot say whether or not your design is correct.
Is Fs 10 kHz? in your time vector? if so then why are you stepping in increments of 1/(4*Fs)?? That changes the sampling rate. Your time increments have to be 1/Fs by definition.
Fs = 1e4;
t = 0:1/Fs:1-1/Fs;
y=sin(1000*2*pi*t)+cos(2*pi*250*t);
% design filter
Hd=fdesign.lowpass('Fp,Fst,Ap,Ast',500,700,0.5,60,10000);
d=design(Hd,'equiripple');
out = filter(d,y);
outdft = fft(out);
plot(abs(outdft))
The sampling rate you use for the signal has to match the sampling rate used in the filter design.