static void Main() { var domain = new Domain(0, 20); domain.NearFunction = Domain.NearQuadratic(2); var chart = new Chart() { Dock = DockStyle.Fill, ChartAreas = { new ChartArea() }, Series = { ((domain.Near(2)+domain.Near(3))/domain.Near(2)).ToPlot(Color.Red), FuzzyNumber.BinaryOperation(domain.Near(2),domain.Near(3),(a,b)=>(a+b)/b).ToPlot(Color.Green) } }; var form = new Form(); form.Controls.Add(chart); Application.Run(form); }
public FuzzyNumber(Domain domain) { this.Domain = domain; values = new double[domain.ArrayLength]; }
static void Main() { domain = new Domain(0, 10); domain.T = Domain.TMin; domain.S = Domain.SMax; var A2=domain.Near(2); var A3=domain.Near(3); SavePlot("2", A2); SavePlot("3", A3); SavePlot("2_cup1_3", A2 | A3); SavePlot("2_cap1_3", A2 & A3); domain.T = Domain.TMul; domain.S = Domain.SSum; SavePlot("2_cap2_3", A2 & A3 ); SavePlot("2_cup2_3", A2 | A3); domain.T = Domain.TMul; domain.S = Domain.SMax; SavePlot("2_plus_2", A2+A2); SavePlot("2_mult_2", A2*A2); SavePlot("8_div_2", domain.Near(8)/A2); SavePlot("4", domain.Near(4)); domain.NearFunction = Domain.NearGauss(0.3); MakePlots("K03"); domain.NearFunction = Domain.NearGauss(3); MakePlots("K3"); domain.NearFunction = Domain.NearQuadratic(1); MakePlots("Q"); domain.NearFunction = Domain.NearGauss(1); domain.T = Domain.TMin; MakePlots("min"); domain.T = Domain.TMul; domain.S = Domain.SSum; MakePlots("nomax"); domain.T = Domain.TMul; domain.S = Domain.SMax; SavePlot("3_times_2", SumTest(3, 2)); SavePlot("2_times_3", SumTest(2, 3)); SavePlot("1_times_6", SumTest(1, 6)); SavePlot("6_mult_1", domain.Near(6)*domain.Near(1)); SavePlot("3_mult_2", domain.Near(3)*domain.Near(2)); SavePlot("F_direct", ((domain.Near(2)+domain.Near(3))/domain.Near(3))); SavePlot("F_ext", FuzzyNumber.BinaryOperation(domain.Near(2), domain.Near(3), (a, b) => (a + b) / b)); domain = new Domain(-5, 5); var tanh = domain.CreateEmpty(); foreach (var e in domain.Arguments) tanh[e] = Math.Tanh(e); SavePlot("Tanh", tanh); }