linear phase notch filter matlab I need to filter 9 Hz from a signal sampled by 256 Hz using a linear phase filter.

If someone can bring an explanation or a code example I would greatly appreciate it.

I have tested his code

function [Hd1,Hd2]=NotchFIR(FS,F0,FG,FGAINdB) % Design
    if (F0 &gt; FS/2)
        warnstr =['WARNING! The Sampling frequency is less than twice the notch frequency. Response will be inaccurate.']
    end        
    if (FG == F0)
        warnstr =['WARNING! User should not set the gain of the notch frequency. Response will be inaccurate.']
    end
    FGAIN = 10^(FGAINdB/20);
    w0 = 2*pi*F0/FS;
    wg = 2*pi*FG/FS;
    GH = abs(1 - 2*cos(w0)*exp(-j*wg) + exp(-j*2*wg));
    G = FGAIN/GH;
    h = [1 -2*cos(w0) 1];
    freqz(G*h,100,[], FS);
    Hd1=G*h;
    Hd2=100; end


     t=0:1/256:1;
     y=sin(2*pi*9*t);    [Hd1,Hd2]=NotchFIR(256,8.9,9.1,1)
     x=filter(Hd1,Hd2,y);
     figure
     plot(t,x);


But the frequency response of the digital filter shows that the selection of the notch frequency wasn't sharp and many frequencies were attenuated.
@omar: I don't know how you obtained your expression for the 'h' coefficients but it's wildly incorrect.  Study the MATLAB documentation regarding the 'firpm()' and 'fir1()' filter design commands.  Experiment, experiment, and experiment again until you understand those commands. Then when you try to use one of those commands to design your desired filter you'll find that your filter needs a truly HUGE number of taps.