时间:2021-05-19
绘制模糊数学中隶属函数分布图
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Collections;
usingSystem.Windows.Forms;
usingSystem.Drawing.Imaging;
usingSystem.Drawing.Drawing2D;
namespaceImageFuzzy
...{
publicpartialclassForm1:Form
...{
privateinttype1;
privateinttype2;
privatestringitem1;
privatestringitem2;
privatefloata;
privatefloatb;
privatefloatc;
privatefloatd1;
privatefloatk;
privatefloatl;
privatefloattempx;
privatefloattempy;
publicvoidInitArray()
...{
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;
}
privatevoiddelete()
...{
a=0;
b=0;
c=0;
d1=0;
k=0;
l=0;
}
privatevoidset1()
...{
this.tbA.Text="1";
this.tbB.Text="2";
this.tbC.Text="3";
this.tbD.Text="4";
this.tbK.Text="1";
this.tbL.Text="2";
}
privatevoidset2()
...{
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";
}
privatevoidset3()
...{
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";
}
privatevoidset4()
...{
this.tbA.Text="1.5";
this.tbB.Text="1.5";
this.tbC.Text="2";
this.tbD.Text="2.5";
this.tbK.Text="0.5";
this.tbL.Text="2";
}
privatevoidset5()
...{
this.tbA.Text="2";
this.tbB.Text="2.5";
this.tbC.Text="3";
this.tbD.Text="3.5";
this.tbK.Text="4";
this.tbL.Text="6";
}
privatevoidset6()
...{
this.tbA.Text="0.5";
this.tbB.Text="1.5";
this.tbC.Text="2";
this.tbD.Text="2.5";
this.tbK.Text="2";
this.tbL.Text="4";
}
publicForm1()
...{
InitializeComponent();
}
privatevoidForm1_Load(objectsender,EventArgse)
...{
//set1();
}
privatevoidForm1_Paint(objectsender,PaintEventArgse)
...{
}
privatevoidpictureBox1_Paint(objectsender,PaintEventArgse)
...{
floatd;
floatx1;
floatx2;
floaty1;
floaty2;
PointFp1;
PointFp2;
intunit=40;//放大倍数
Fontfont=newFont("MSUIGothic",12);
SolidBrushbrush=newSolidBrush(Color.Black);
floatinterval=0.001F;//步进刻度,值越小越精确(必须大小0),但速度也越慢
PointFo=newPointF(this.pictureBox1.Width/2,this.pictureBox1.Height/2);
e.Graphics.DrawLine(Pens.Red,0,this.pictureBox1.Height/2,this.pictureBox1.Width,this.pictureBox1.Height/2);
e.Graphics.DrawLine(Pens.Red,this.pictureBox1.Width/2,0,this.pictureBox1.Width/2,this.pictureBox1.Height);
e.Graphics.DrawString("O",font,brush,o);
if(type1==0)
...{
for(d=-6.28F;d<6.28F;d+=interval)
...{
x1=o.X+d*unit;
x2=o.X+(d+interval)*unit;
y1=o.Y-(float)(unit*System.Math.Sin(d));
y2=o.Y-(float)(unit*System.Math.Sin(d+interval));
p1=newPointF(x1,y1);
p2=newPointF(x2,y2);
e.Graphics.DrawLine(Pens.Black,p1,p2);
}
}
elseif(type1==1)
...{
//set1();
PointFo1=newPointF(this.pictureBox1.Width/2,this.pictureBox1.Height/4);
e.Graphics.DrawString("1",font,brush,o1);
if(type2==1)
...{
for(d=0;d<a;d+=interval)
...{
x1=o.X+d*unit;
x2=o.X+(d+interval)*unit;
y1=o.Y-(float)(this.pictureBox1.Height/4);
y2=o.Y-(float)(this.pictureBox1.Height/4);
p1=newPointF(x1,y1);
p2=newPointF(x2,y2);
e.Graphics.DrawLine(Pens.Black,p1,p2);
tempx=x2;
tempy=this.pictureBox1.Height/2;
}
PointFo2=newPointF(tempx,tempy);
e.Graphics.DrawString(a.ToString(),font,brush,o2);
}
elseif(type2==2)
...{
for(d=a;d<2*a;d+=interval)
...{
x1=o.X+d*unit;
x2=o.X+(d+interval)*unit;
y1=o.Y-(float)(this.pictureBox1.Height/4);
y2=o.Y-(float)(this.pictureBox1.Height/4);
p1=newPointF(x1,y1);
p2=newPointF(x2,y2);
e.Graphics.DrawLine(Pens.Blue,p1,p2);
}
PointFo2=newPointF(tempx,tempy);
e.Graphics.DrawString(a.ToString(),font,brush,o2);
}
elseif(type2==3)
...{
for(d=a;d
...{
x1=o.X+d*unit;
x2=o.X+(d+interval)*unit;
y1=o.Y-(float)(this.pictureBox1.Height/4);
y2=o.Y-(float)(this.pictureBox1.Height/4);
p1=newPointF(x1,y1);
p2=newPointF(x2,y2);
e.Graphics.DrawLine(Pens.Blue,p1,p2);
}
PointFo2=newPointF(tempx,tempy);
e.Graphics.DrawString(a.ToString(),font,brush,o2);
}
}
elseif(type1==2)
...{
//set2();
PointFo1=newPointF(this.pictureBox1.Width/2,this.pictureBox1.Height/4);
e.Graphics.DrawString("1",font,brush,o1);
12345下一页阅读全文
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
1、生成正态分布数据并绘制概率分布图importpandasaspdimportnumpyasnpimportmatplotlib.pyplotasplt#根据
制作分布图,在地图显示多个地点,能够让企业直观了解市场业务分布,无论应用在哪个具体的行业,地图数据的显示质量都直接影响着用户对于市场的把控,那么,分布图这么制作
大家都知道Excel可以做表格,但不一定就会做出进度表格的分布图,小编这就告诉大家如何做进度分布图美化表格,希望可以帮助到有此需要的小伙伴们1、打开Excel,
图1-1死亡企业地区分布图图1-2B2B企业地区分布情况图1-3死亡B2B企业各区域分布状况图2-1B2B企业获投状况图2-2死亡B2B企业获投状况图2-3死亡
python画分布图代码示例:#encoding=utf-8importmatplotlib.pyplotaspltfrompylabimport*#支持中文m