%
%   mean_removal_Hanning.m  ver 1.2  by Tom Irvine
%
function[y]=mean_removal_Hanning(y,mr_choice,hw_choice)
%

y=fix_size(y);

n=length(y);
mu=mean(y);
%
    if(mr_choice==1)
        y=y-mu;
    end
%    
    if(hw_choice==2)  % Hanning
        
        ae=sqrt(8/3);

        hw=hann(n);

        hw=fix_size(hw);

        y=(y.*hw)*ae;
        
    end
%    

    if(hw_choice==3)  % Flat Top

        ys=std(y);

        fw = flattopwin(n);

        fw=fix_size(fw);

        y=y.*fw;

        y=y*ys/std(y);

    end
