private void ComputeResponse()
        {
            var crossFr  = CrossFreqSlider.Value;
            var crossLen = Convert.ToInt32(CrossLengthFreqSlider.Value);
            var npoles1  = Convert.ToInt32(NPolesLowSlider.Value);
            var npoles2  = Convert.ToInt32(NPolesHighSlider.Value);
            var lambda1  = LambdaLowSlider.Value;
            var lambda2  = LambdaHighSlider.Value;


            if (target != null)
            {
                Array.Resize(ref filter, target.Length);
                int size = target.Length;
                ParFiltDesign.computeResponse(filter, W, target, out size, npoles1, npoles2, crossFr, crossLen,
                                              lambda1, lambda2, Fs, NFIR, useNAK);
                MyPlot.AddToPlotdB(fr, filter, "filter", 1);
            }
        }
        private void LoadResponse(object sender, RoutedEventArgs e)
        {
            int size = 1600;

            double[] w = new double[size];
            double[] H = new double[size];


            bool result = false;

            if (ItemSelected == null)
            {
                return;
            }
            do
            {
                string ff = FilePath + "\\" + ItemSelected;

                result = ParFiltDesign.loadResponse(w, H, out size, FilePath + "\\" + ItemSelected);

                if (!result)
                {
                    if (size < 0)   //error occured
                    {
                        return;
                    }
                    w = new double[size];
                    H = new double[size];
                }
            } while (!result);

            Array.Resize(ref w, size); //shortens the output to correct length
            Array.Resize(ref H, size); //shortens the output to correct length

            fr = w.Select(r => r * Fs / (2 * Math.PI)).ToArray();
            MyPlot.AddToPlotdB(fr, H, "Target", 0);
            target = H;
            W      = w;
        }