日期:2008-03-23  浏览次数:20437 次

Aiyiweb.Com提示:本文给出了有个在.NET环境下绘制模糊数学中隶属函数分布图的实例代码,并对其作了简单讲解,大家可以学习一下。

  本文给出了有个在.NET环境下绘制模糊数学中隶属函数分布图的实例代码,并对其作了简单讲解,大家可以学习一下。

以下是援用片段:
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Collections;
  using System.Windows.Forms;
  using System.Drawing.Imaging;
  using System.Drawing.Drawing2D;
  namespace ImageFuzzy
  ...{
  public partial class Form1 : Form
  ...{
  private int type1;
  private int type2;
  private string item1;
  private string item2;
  private float a;
  private float b;
  private float c;
  private float d1;
  private float k;
  private float l;
  private float tempx;
  private float tempy;
  public void InitArray()
  ...{
  type1 = 0;
  type2 = 0;
  k = 2;
  item1 = this.comboBox1.Text.ToString();
  item2 = this.comboBox2.Text.ToString();
  this.groupBox1.Text = item1 + item2 + "图形";
  a = float.Parse(this.tbA.Text.Trim().ToString());
  b = float.Parse(this.tbB.Text.Trim().ToString());
  c = float.Parse(this.tbC.Text.Trim().ToString());
  d1 = float.Parse(this.tbD.Text.Trim().ToString());
  k = float.Parse(this.tbK.Text.Trim().ToString());
  l = float.Parse(this.tbL.Text.Trim().ToString());
  type1 = this.comboBox1.SelectedIndex+1;
  type2 = this.comboBox2.SelectedIndex+1;
  }
  private void delete()
  ...{
  a = 0;
  b = 0;
  c = 0;
  d1 = 0;
  k = 0;
  l = 0;
  }
  private void set1()
  ...{
  this.tbA.Text = "1";
  this.tbB.Text = "2";
  this.tbC.Text = "3";
  this.tbD.Text = "4";
  this.tbK.Text = "1";
  this.tbL.Text = "2";
  }
  private void set2()
  ...{
  this.tbA.Text = "1";
  this.tbB.Text = "1.5";
  this.tbC.Text = "2";
  this.tbD.Text = "2.5";
  this.tbK.Text = "1";
  this.tbL.Text = "2";
  }
  private void set3()
  ...{
  this.tbA.Text = "0.5";
  this.tbB.Text = "1.5";
  this.tbC.Text = "2";
  this.tbD.Text = "3";
  this.tbK.Text = "3";
  this.tbL.Text = "2";
  }
  private void set4()
  ...{
  this.tbA.Text = "1.5";
  this.tbB.Text = "1.5";
  this.tbC.Text = "2&