function [S_filt]=clutter_filt(S,f,spect_width_seed,noise_level)
% Frequency associated with noise should be at 0 before doing this function
S_filt=S;
sigma=spect_width_seed/2;
u_central=find(f==0);
f1=f(u_central-1:u_central+1);
S1=S(f1);

ftype=fittype('1/(sqrt(a*2*pi)*exp(-(x^2)/2*a^2))');
    opts=fitoptions(ftype);
    opts.MaxFunEvals=1000;
    opts.MaxIter=600;

     opts.StartPoint=sigma;
    %opts.Robust='on';
     fresult=fit(f1,S1,ftype,opts);
    
    clutter_gauss=1/(sqrt(fresult.a*2*pi)*exp(-(f^2)/2*fresult.a^2);
    
    u_clutter=find(clutter_gauss >=noise_level);
    S_filt(f(u_clutter))=0;
    
    u_weather_signal=find(S_filt >0);
    opts.StartPoint=[];
    f1=f(u_weather_signal);
    S1=S_filt(u_weather_signal);
    fresult=fit(f1,S1,ftype,opts);
    replaced_comp=1/(sqrt(fresult.a*2*pi)*exp(-(f(u_clutter)^2)/2*fresult.a^2);
    S_filt(f(u_clutter))=replaced_comp;
    
    
    
    
    