示例#1
0
 public static double window_func(WindowFunctionType type, double x)
 {
     if (type == WindowFunctionType.Akaike)
     {
         return(wnd_akaike(x));
     }
     else if (type == WindowFunctionType.Bartlett)
     {
         return(wnd_bartlett(x));
     }
     else if (type == WindowFunctionType.Blackman)
     {
         return(wnd_blackman(x));
     }
     else if (type == WindowFunctionType.Blackman_Harris)
     {
         return(wnd_blackman_harris(x));
     }
     else if (type == WindowFunctionType.Blackman_Nattall)
     {
         return(wnd_blackman_nattall(x));
     }
     else if (type == WindowFunctionType.flap_top)
     {
         return(wnd_flap_top(x));
     }
     else if (type == WindowFunctionType.Gauss)
     {
         throw new Exception("too few argument for Gauss window function");
     }
     else if (type == WindowFunctionType.Hamming)
     {
         return(wnd_hamming(x));
     }
     else if (type == WindowFunctionType.Hann)
     {
         return(wnd_hann(x));
     }
     else if (type == WindowFunctionType.Kaiser)
     {
         throw new Exception("too few argument for Kaiser window function");
     }
     else if (type == WindowFunctionType.Nuttall)
     {
         return(wnd_nuttall(x));
     }
     else if (type == WindowFunctionType.Parzen)
     {
         return(wnd_parzen(x));
     }
     else if (type == WindowFunctionType.rectangular)
     {
         return(wnd_rectangular(x));
     }
     else if (type == WindowFunctionType.Welch)
     {
         return(wnd_welch(x));
     }
     return(0.0);
 }
示例#2
0
 public static double window_func(WindowFunctionType type, double x, params double[] param)
 {
     if (type == WindowFunctionType.Akaike)
     {
         return(wnd_akaike(x));
     }
     else if (type == WindowFunctionType.Bartlett)
     {
         return(wnd_bartlett(x));
     }
     else if (type == WindowFunctionType.Blackman)
     {
         return(wnd_blackman(x));
     }
     else if (type == WindowFunctionType.Blackman_Harris)
     {
         return(wnd_blackman_harris(x));
     }
     else if (type == WindowFunctionType.Blackman_Nattall)
     {
         return(wnd_blackman_nattall(x));
     }
     else if (type == WindowFunctionType.flap_top)
     {
         return(wnd_flap_top(x));
     }
     else if (type == WindowFunctionType.Gauss)
     {
         return(wnd_gauss(x, param[0]));
     }
     else if (type == WindowFunctionType.Hamming)
     {
         return(wnd_hamming(x));
     }
     else if (type == WindowFunctionType.Hann)
     {
         return(wnd_hann(x));
     }
     else if (type == WindowFunctionType.Kaiser)
     {
         return(wnd_kaiser(x, param[0]));
     }
     else if (type == WindowFunctionType.Nuttall)
     {
         return(wnd_nuttall(x));
     }
     else if (type == WindowFunctionType.Parzen)
     {
         return(wnd_parzen(x));
     }
     else if (type == WindowFunctionType.rectangular)
     {
         return(wnd_rectangular(x));
     }
     else if (type == WindowFunctionType.Welch)
     {
         return(wnd_welch(x));
     }
     return(0.0);
 }
 public static WindowFunction GetWindowFunctionFromType(this WindowFunctionType type) => type switch
 {