SampleApp.MainForm.runFuzzySetTestButton_Click C# (CSharp) Method

runFuzzySetTestButton_Click() private method

private runFuzzySetTestButton_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void runFuzzySetTestButton_Click(object sender, EventArgs e)
        {
            ClearDataSeries();

            // create 2 fuzzy sets to represent the Cool and Warm temperatures
            FuzzySet fsCool = new FuzzySet("Cool", new TrapezoidalFunction(13, 18, 23, 28));
            FuzzySet fsWarm = new FuzzySet("Warm", new TrapezoidalFunction(23, 28, 33, 38));

            // get membership of some points to the cool fuzzy set
            double[,] coolValues = new double[20, 2];
            for (int i = 10; i < 30; i++)
            {
                coolValues[i - 10, 0] = i;
                coolValues[i - 10, 1] = fsCool.GetMembership(i);
            }

            // getting memberships of some points to the warm fuzzy set
            double[,] warmValues = new double[20, 2];
            for (int i = 20; i < 40; i++)
            {
                warmValues[i - 20, 0] = i;
                warmValues[i - 20, 1] = fsWarm.GetMembership(i);
            }

            // plot membership to a chart
            chart.UpdateDataSeries("COOL", coolValues);
            chart.UpdateDataSeries("WARM", warmValues);
        }
MainForm