GHXi 发表于 2007-11-22 00:44

求助:模糊系统、模糊神经网络及应用程序设计例子什么不对

求助:模糊系统、模糊神经网络及应用程序设计例子什么不对
请高手帮我看看这个程序为什么不对?

#define q1         0.00012
#define q2         0.008
#define M          81
#define SAMPLES    80
#define OK         0
/*定义第二个图象的位置*/
#define graph2_x18
#define graph2_x2632
#define graph2_y180
#define graph2_y2450
/*显示活动条的位置*/
#define act_bar_x140
#define act_bar_y1110
#define act_bar_x2600
#define act_bar_y2140
/*显示训练次数和均方误差的位置*/
#define train_x156
#define train_y400
#define train_x448
#define train_y400
/*显示询问框的位置*/
#define ask_x1100
#define ask_y1200
#define ask_x2540
#define ask_x2260
/* 定义测试样本的次数 */
#define T      10
#define LEFT   0x02
#define CTRL   0x04
#define ALT    0x08
#include "bios.h"
#include "ctype.h"
#include "math.h"
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "graphics.h"
#include "iostream.h"
#include "alloc.h"
#include "string.h"
static double      p;
static long double   w;
static double      a;
static double      b;

static long double   y;
static long double   xi,yd;
static double      t_Y;
static double      t_X1;
static double      t_X2;
static double      t_X3;
static double      t_X4;

long double (*f)(long double,long double,long double);
void far *ptr;
int maxx=639,maxy=479;
int train;
double error=1,mean;
/* 样本数据x1x2x3x4以及期望值输出yd */
static long double YD[]=
{
/* 样本数据省略*/
};

static long double X1[]=
{
/* 样本数据省略*/
};
static long double X2[]=
{
/* 样本数据省略*/
};
static long double X3[]=
{
/* 样本数据省略*/
};
static long double X4[]=
{
};
/* 初始化隶属度函数的参数a,b*/
static long double al_before{0,15,0,7.5};
static long double bl_before{3,3,3,1.5};
/* 隶属度函数*/
inline long double uPL(long double x, long double a, long double b)
{
if(x>15) return(1);
else return(exp(-(x-a)*(x-a)/b));
}
inline long double uNL(long double x, long double a, long double b)
{
if(x>=0) return(1);
else return(1);
}
inline long double uZO(long double x, long double a, long double b)
{
return(exp(-(x-a)*(x-a)/b));
}
/* 计算y到y的值*/
int yL()
{int i;
for(i=1;i<=M;i++)
y=p+p*xi+p*xi+p*xi+p*xi;
return OK;}
/* 计算w到w的值*/
int wL()
{
int i,j,k,l,m;
for(i=1;i<=3;i++)
for(j=1;j<=3;j++)
for(k=1;k<=3;k++)
   for(l=1;l<=3;l++)
    {m=27*(i-1)+9*(j-1)+3*(k-1)+1;
   w=((*f)(xi,a,b))*((*f)(xi,a,b))*
   ((*f)(xi,a,b))*((*f)(xi,a,b));
}
   return OK;}

/* 计算BP神经网络的输出值*/
long double Y_effect()
{int i;
long double WY=0,W=0;
yL();
wL();
for(i=1;i<=M;i++)
{WY=WY+w*y;
W=W+w;}
return(WY/W);}
int border(int x1,int y1,int x2,int y2,int color)
{sectcolor(color);
rectangle(x1,y1,x2,y2);
return OK;}
/* 在X轴上画刻度*/
int ke_du_x(int x1,int x2,int y,int range,int color,int flag)
{
float i,j;
int on=3;
float rule;
char string;
rule=(x2-x1)/range;
setcolor(color);
for(i=x1;i<=x2;i=i+rule)
{if(flag) ltoa(((i-x1)/rule+1),string,10);
else ltoa(((i-x1)/rule+1),string,10);
if(((on++)%3==0)&&(flag))
outtextxy(i-3,y+3,string);
else if(!flag)
outtextxy(i-3,y+3,string);
line(i,y,i,y-6);
if((i>x1)&&(!flag))
for(j=i-rule;j<=i;j=j+rule/5)
line(i,y,i,y-3);
return OK;}

/* 在y轴上画刻度*/
int ke_du_y(int x,int y1,int y2,int range,int color)
{
float i,j;
float rule;
char string;
rule=(y2-y1)/range;
settextjustify(0,2);
setcolor(color);
for(i=(y2-rule);i>=y1;i=i-rule)
{ltoa((y2-i)/rule),string,10);
outtextxy(x-7,i-3,string);
line(x,i,x+6,i);
for(j=(i+rule);j>=i;j=j-rule/5)
line(x,j,x+3,j);
}
return OK;}
/* 图形模型初始化 */
initgra()
{
int gdriver=DETECT,gmode,errorcode;
if(registerbgidriver(EGAVGA_driver)<0) goto err;
if(registerbgifont(triplex_font)<0) goto err;
if(registerbgifont(small_font)<0) goto err;
initgraph(&gdriver,&gmode,"c:\\tc");
err:
errorcode=graphresult();
if(errorcode != grOK)
{
printf("graphics error:%s\n",grapherrormsg(errorcode));
printf("press any key to halt:");
getch();
exit(1);
}
return OK;}

/* 画第一幅图象*/
int draw_graph1()
{
long double i,PL;
cleardriver();
setbkcolor(WHITE);
border(0,0,639,479,LIGHTBLUE);
settextstyle(0,0,0);
for(i=0;i<=15;i=i+0.005)
{putpixel(20+40*i,(230-200*uPL(i,al_before,bl_before)),DARKGRAY);
putpixel(20+40*i,(230-200*uNL(i,al_before,bl_before)),LIGHTBLUE);
putpixel(20+40*i,(230-200*uZO(i,al_before,bl_before)),LIGHTRED);
}
outtextxy(25+40*1,80,"uPL");
outtextxy(20+40*7.2,80,"uZO");
outtextxy(15+40*13.5,80,"uNL");
border(20,25,620,230,DARKGRAY);
ke_du_x(20,620,230,15,LIGHTBLUE,0);
ke_du_y(20,25,230,1,LIGHTBLUE);
setfillstyle(l,LIGHTBLUE);
bar(0,0,639,20);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(WHITE);
setfillstyle(DEFULT_FONT,0,1);
outtextxy(320,10,"GRAPH1");
for(i=0;i<=15;i=i+0.005)
{putpixel(20+40*i,(455-200*uPL(i,a,b+1.2))),DARKGRAY);
putpixel(20+40*i,(455-200*uNL(i,a,b+1.5))),LIGHTBLUE);
putpixel(20+40*i,(455-200*uZO(i,a,b+1.2))),LIGHTRED);
}
setcolor(LIGHTBLUE);
settextjustify(0,2);
outtextxy(30+40*1,320,"uPL");
outtextxy(20+40*7.2,320,"uZO");
outtextxy(20+40*13.2,320,"uNL");
}
{border(20,250,620,455,DARKGRAY);
ke_du_x(20,620,455,15,LIGHTBLUE,0);
ke_du_y(20,250,455,1,LIGHTBLUE);}
return OK;}

/* 画第二幅图象*/
int draw_graph2()
{
long double i,PL;
float rule=(graph2_x2-graph2_x1)/(SAMPLES-1);
cleardriver();
setbkcolor(WHITE);
border(0,0,639,479,LIGHTBLUE);
border(graph2_x1,graph2_y1-20,graph2_x2,graph2_y2,DARKGRAY);
ke_du_x(graph2_x1,graph2_x2,graph2_y2,(SAMPLES-1),LIGHTBLUE,1);
ke_du_y(graph2_x1,graph2_y1,graph2_y2,1,LIGHTBLUE);
setfillstyle(1,LIGHTBLUE);
bar(1,1,638,29);
border(1,1,638,29,DARKGRAY);
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(WHITE);
settextstyle(DEFULT_FONT,0,1);
outtextxy(320,15,"GRAPH2");
setfillstyle(1,YELLOW);
bar(245,80,395,115);
border(245-1,80-1,395+1,115+1,DARKGRAY);
settextstyle(DEFULT_FONT,0,0);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(295,90,"PREDICTED");
setlinestyle(DOTTED_LINE,1,1);
line(265,90,285,90);
setfillstyle(SOLIDD_FILL,LIGHTRED);
fillellipse(275,90,3,3);
outtextxy(295,105,"RAEL");
line(265,105,285,105);
setcolor(BLUE);
circle(275,105,4);

moveto(graph2_x1,graph2_y2-(YD*400));
for(i=0;i<=SAMPLES-1+T;i++)
{
if(i<=SAMPLES-1)
{
setcolor(LIGHTRED);
lineto(graph2_x1+rule*i,graph2_y2-(YD*400));
setcolor(BLUE);
circle(graph2_x1+rule*i,graph2_y2-(YD*400),4);
}
else
{
x=t_X1;
x=t_X2;
x=t_X3;
x=t_X4;
t_Y=(0.472*((1+sin(M_PI*(xi-0.5)))/2)
+0.607*((1+sin(M_PI*(xi-0.5)))/2)
+0.779*((1+sin(M_PI*(xi-0.5)))/2)
+((1+sin(M_PI*(xi-0.5)))/2)/2.858;
setcolor(LIGHTRED);
lineto(graph2_x1+rule*i,graph2_y2-(t_Y*400));
setcolor(BLUE);
circle(graph2_x1+rule*i,graph2_y2-(t_Y*400),4);
}
}

moveto(graph2_x1,graph2_y2-(Y_effect())*400;
for(i=0;i<=SAMPLES-1+T;i++)
{
if(i<=SAMPLES-1)
{
xi=X1;
xi=X2;
xi=X3;
xi=X4;
setcolor(BLUE);
lineto(graph2_x1+rule*i,graph2_y2-(Y_effect())*400);
setfillstyle(SOLID_FILL,LIGHTRED);
fillellipse(graph2_x1+rule*i,graph2_y2-(Y_effect())*400),3,3);
}
else
{
xi=t_X1;
xi=t_X2;
xi=t_X3;
xi=t_X4;
setcolor(BLUE);
lineto(graph2_x1+rule*i,graph2_y2-(Y_effect())*400);
setfillstyle(SOLID_FILL,LIGHTRED);
fillellipse(graph2_x1+rule*i,graph2_y2-(Y_effect())*400),3,3);
}
}
return OK;}

/* 保存屏幕图象函数*/
void save_screen(void far *buf)
{
unsigned size;
int ystart=0,yend,yincr,block;
yincr=(maxy+1)/4;
yend=yincr;
size=imagesize(0,ystart,maxx,yend);
for(block=0;block<=3;block++)
{
if((buf=farmalloc(size))==NULL)
{
closegraph();
printf("Error:not enough heap space in save_screen().\n"
exit(1);
}
getimage(0,ystart,maxx,yend,buf);
ystart=yend+1;
yend+=yincr+1;
}
}

/* 恢复屏幕图象函数*/
void restore_screen(void far *buf)
{
int ystart=0,yend,yincr,block;
yincr=(maxy+1)/4;
yend=yincr;
for(block=0;block<=3;block++)
{
putimage(0,ystart,buf,COPY_PUT);
farfree(buf);
ystart=yend+1;
yend+=yincr+1;
}
}

/*定期义用户界面*/
int interfce()
{
setbkcolor(LIGHTBLUE);
boeder(0,0,639,479,WHITE);
settextstyle(0,0,0);
settextjustify(1,1);
outtextxy(Train_x,Train_y,"Train time:");
outtextxy(error_x,error_y,"Mean error:");
outtextxy(Train_x-30,Train_y-80,"X1=:");
outtextxy(error_x,Train_y-80,"X2=:");
outtextxy(Train_x-30,Train_y-60,"X3=:");
outtextxy(error_x,error_y-60,"X4=:");
outtextxy(act_bar_x1-5,act_bar_y1-5,act_bar_x2+5,act_bar_y2+5);
setfillstyle(1,WHITE);
bar(act_bar_x1,act_bar_y1,act_bar_x2,act_bar_y2);
settextjustify(1,1);
settextjustify(TRIPLEX_FONT,0,4);
{
setcolor(WHITE);
outtextxy(319,24,"FUZZY LOGIC NETWORK MODELLING");
setcolor(DARKGRAY);
outtextxy(321,26,"FUZZY LOGIC NETWORK MODELLING");
setcolor(LIGHTGRAY);
outtextxy(320,25,"FUZZY LOGIC NETWORK MODELLING");
settextstyle(0,0,0);
outtextxy(320,470,"Press shife+lt+ctrl to see the graph......");
}
setcolor(WHITE);
line(0,50,639,50);
line(0,460,639,460);
line(0,Train_y-8,639,Train_y-8);
line(0,Train_y+8,639,Train_y+8);
line(320,Train_y-8,320,Train_y+8);
line(0,Train_y-90,639,Train_y-90);
line(0,Train_y-50,639,Train_y-50);
line(0,Train_y-70,639,Train_y-70);
line(320,Train_y-50,320,Train_y-90);
return OK;
}
/*交互窗口函数*/
int ask()
{
char key;
char *str1="Press ESC to exit system";
char *str2="Press ENTER to contiue system";
char *str3="to Go on system";
border(ask_x1,ask_y1,ask_x2,ask_y2,LIGHTBLUE);
setfillstyle(SOLIDD_FILL,LIGHTRED);
bar3d(ask_x1+1,ask_y1+1,ask_x2-1,ask_y2,2,1);
setcolor(BLUE);
settextstyle(2,0,6);
outtextxy(ask_x1+20,ask_y1+15,str1);
outtextxy(ask_x1+20,ask_y1+30,str2);
outtextxy(ask_x1+20,ask_y1+45,str3);
re_input:
key=getch();
if(key==13) return(1);
else if(key==27) return(0);
}

/* 保存p[][],a[][],b[][]数组的值及误差和训练次数*/
int save_pab()
{
FILE *fpp,*fpa,*fpb,*fpt,*fpe;
int i,j;
fpp=fopen("p.dat","wt");
fpa=fopen("a.dat","wt");
fpb=fopen("b.dat","wt");
fpt=fopen("Train.dat","wt");
fpe=fopen("error.dat","wt");
fprintf(fpp,"%s","    P0    P1    P2    P3    P4\n";
for(i=1;i<=M;i++)
    {for(j=1;j<=4;j++)
      {if(j==0)
            fprintf(fpp,"%d",i);
      if(p<0)
      {
      if(j>=10)
            fprintf(fpp,"%-3.8f",p);
      else
            fprintf(fpp,"%-3.8f",p);
            }
         else
            {if(i>=10)
            fprintf(fpp,"%-3.8f",p);
               else
            fprintf(fpp,"%-3.8f",p);
            }       }
            fprintf(fpp,"\n");
            }
       for(i=1;i<=M;i++)
         {for(j=1;j<=4;j++)
            {fprintf(fpa,"%-3.6f",a);
            fprintf(fpb,"%-3.6f",b);
            }
            fprintf(fpa,"\n");
            fprintf(fpb,"\n");
            }
            fprintf(fpt,"%s%d,","THE Train time is:",Train);
            fprintf(fpe,"%s%f,","THE Mean error is:",error);
            fcloss(fpp);
            fcloss(fpa);
            fcloss(fpb);
            fcloss(fpt);
            fcloss(fpe);
return OK;
}
/* 生成测试样本的随机数*/
int create_rand()
{
int i;
randomize();
for(i=0;i<=T-1;i++)
{
t_xi=(double) random(1500)/100;
t_xi=(double) random(1500)/100;
t_xi=(double) random(1500)/100;
t_xi=(double) random(1500)/100;
}
return OK;
}
/* 用测试样本检验建模的效果并生成测试文件*/
test_sample()
{
FILE *fpt;
int i;
double y,x1,x2,x3,x4;
double Y;
double error,mean=0;
fpt=fopen("test.dat","wt");
create_rand();
i=0;
fprintf(fpt,"%s","    x1    x2    x3    x4      Predict      Real      Error";
While(i<T)
{
xi=t_xi;
xi=t_xi;
xi=t_xi;
xi=t_xi;
Y=Y_effect();
t_Y=(0.472*((1+sin(M_PI*(xi-0.5)))/2)
+0.607*((1+sin(M_PI*(xi-0.5)))/2)
+0.779*((1+sin(M_PI*(xi-0.5)))/2)
+((1+sin(M_PI*(xi-0.5)))/2)/2.858;
error=fabs(Y-t_Y);
if(i<(T-1))
{fprintf(fpt,"\n%-d%-5.2f    %-5.2f%-5.2f%-5.2f%-5.6f%-5.6f%-5.6f","\n",
(i+1),t_X1,t_X2,t_X3,t_X4,Y,t_Y,error);}
else fprintf(fpt,"\n%-d%-5.2f    %-5.2f%-5.2f%-5.2f%-5.6f%-5.6f%-5.6f","\n",
(i+1),t_X1,t_X2,t_X3,t_X4,Y,t_Y,error);}
mean=mean+error;
i++;
}
fprintf(fpt,"\n Mean error is%-3.6f",mean/10);
fclose(fpt);
return OK;
}
/* 在浮点数字符串的位置插入小数点*/
insert_dot(char *str,int dec)
{
char c;
int i,j,len;
len=strlen(str);
if(dec>0)
{for(i=0;i<=(len-dec);i++)
*(str+len-i+1)= *(str+len-i)
*(str+dec)=".";
}
else if(i<0)
{j=abs(dec);
for(i=1;i<=len;i++)
*(str+len-i+1+j)= *(str+len-i-1);
*str="0",
*(str+1)=".";
for(i=1;i<=j;i++)
*(str+i+1)="0";
}
else
{for(i=0;i<=(len-dec);i++)
*(str+len-i+2)= *(str+len-i)
*(str+1)=".";
*str="0";
}
return 0;
}
/*初始化用户界面的所有参数*/
init_graph_all_date(int count,int ndig,char *str)
{
int dign,dec;
setcolor(LIGHTRED);
settextjustify(0,2);
itoa(train,str,10);
outtextxy(train_x+50,train_y-4,str);
mean=1,0;
str=fcvt(mean,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+50,error_y-4,str);
itoa(count,str,10);
outtextxy(act_barx2,act_bar_y2+10,str);
setcolor(YELLOW);
str=fcvt(X1,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-84,str);
str=fcvt(X2,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-84,str);
str=fcvt(X3,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-64,str);
str=fcvt(X4,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-64,str);
return OK;
}
/*show1_x1_x4和show2_x1_x4在用户界面中动态显示*/
/*样本数据X1,X2,X3,X4的值*/
int show1_x1_x4(int count,int ndig,char *str)
{
int dec,sign;
if(count>=2)
{
settextstyle(0,0,0);
srtcolor(getbkcolor());
srttextjustify(0,2);
str=fcvt(X1,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-84,str);
str=fcvt(X2,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-84,str);
str=fcvt(X3,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-64,str);
str=fcvt(X4,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-64,str);
}
return OK;
}
int show2_x1_x4(int count,int ndig,char *str)
{
int dec,sign;
settextstyle(0,0,0);
srttextjustify(0,2);
if((train>=1)&&(count==2))
{setcolor(getbkcolor());
str=fcvt(X1,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-84,str);
str=fcvt(X2,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-84,str);
str=fcvt(X3,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-64,str);
str=fcvt(X4,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-64,str);
}
setcolor(YELLOW);
str=fcvt(X1,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-84,str);
str=fcvt(X2,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-84,str);
str=fcvt(X3,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(train_x-10,train_y-64,str);
str=fcvt(X4,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+20,error_y-64,str);
return OK;
}
/*显示活动条的当前运行状态*/
int show_act_bar(int count,float setp)
{
settextjustify(0,2);
setfillstyle(1,LIGHTGREEN);
bar(act_bar_x1,act_bar_y1,act_bar_x1+((count-1)*setp),act_bar_y2);
return OK;
}
/*show_mean1和show_mean2显示当前误差状态*/
int show_mean1(int ndig,char *str)
{
int dec,sign;
setcolor(getbkcolor());
str=fcvt(mean,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+50,error_y-4,str);
return OK;
}
int show_mean2(int ndig,char *str)
{
int sign,dec;
settextstyle(0,0,0);
str=fcvt(mean,ndig,&dec,&sign);
insert_dot(str,dec);
outtextxy(error_x+50,error_y-4,str);
return OK;
}
/*在用户界面中动态显示样本组数*/
int show_sample_no(int count,char *str)
{settextstyle(0,0,0);
setcolor(getbkcolor());
itoa((count-2),str,10);
outtextxy(act_bar_x2,act_bar_y2+10,str);
if((train>=1)&&(count==2))
outtextxy(act_bar_x2,act_bar_y2+10,"80");
setcolor(LIGHTRED);
itoa((count-1),str,10);
outtextxy(act_bar_x2,act_bar_y2+10,str);
return OK;
}
/*初始化用户界面的活动条*/
int init_bar()
{
setfillstyle(1,WHITE);
bar(act_bar_x1,act_bar_y1,act_bar_x2,act_bar_y2);
return OK;
}
/*用户界面动态显示训练次数*/
int show_train(char *str)
{
setfillstyle(0,0,0);
setcolor(getbkcolor());
itoa(train,str,10);
outtextxy(train_x+50,train_y-4,str);
setcolor(LIGHTRED);
itoa((train+1),str,10);
outtextxy(train_x+50,train_y-4,str);
setcolor(LIGHTRED);
return OK;
}

/* 主函数*/
main()
{
unsigned i,j,k,l,m;
int count=0;
int modifiers;
int contin;
char *str;
int dec,sign,ndig=6;
float setp=(act_bar_x2-act_bar_x1)/SAMPLES;
long double ww;
long double wwy;
long double Y;
long double J;
long double temp_ai;
f=uPL;
f=uNL;
F=uZo;
str=(char *) malloc(20);
}

/*初始化a[]b[]*/
for(i=0;i<=3;i++)
for(j=0;j<=3;j++)
for(k=0;k<=3;k++)
for(l=0;l<=3;l++)
{m=27*(i-1)+9*(j-1)+3*(k-1)+l;
a=al_before;
a=al_before;
a=al_before;
a=al_before;
b=bl_before;
b=bl_before;
b=bl_before;
b=bl_before;
}
initgra();
interface();
init_graph_all_data(count,ndig,str);
create_rand();
/*调整平均误差*/
while(mean>0.005)
{
xi=X1;
xi=X2;
xi=X3;
xi=X4;
yd=YD;
Y=Y_effect();
/*对80组样本调整误差*/
while(count<SAMPLES+1)
{
while(((fabs(Y-yd))*(fabs(Y-yd)))>0.000015)
{
ww=0;
wwy=0;
for(j=1;j<=M;j++)
{ww=ww+w;
wwy=wwy+w*y;
}
for(i=1;i<=M;i++)
p=p-(q1*(Y-yd)*w)/ww;
p=p-(q1*(Y-yd)*w)/ww*xi;
p=p-(q1*(Y-yd)*w)/ww*xi;
p=p-(q1*(Y-yd)*w)/ww*xi;
p=p-(q1*(Y-yd)*w)/ww*xi;
for(j=1;j<=4;j++)
a=a-(q2*(Y-yd)*(y*ww-wwy)*2*(xi-(temp_ai=a))*w)/(b*pow(ww,2));
for(j=1;j<=4;j++)
b=b-(q2*(Y-yd)*(y*ww-wwy)*pow((xi-temp_ai),2)*w)/(pow(b*ww,2));
if((modifiers&LEFT)&&(modifiers&CTRL)&&(modifiers&ALT))
{
save_screen(ptr);
fflush(stdin);
goto FINISH;}
}
BB:
Y=Y_effect();
}
show1_x1_x4(count,ndig,str)
xi=X1;
xi=X2;
xi=X3;
xi=X4;
yd=Yd;
show2_x1_x4(count,ndig,str);
show_cat_bar(count,step);
show_sample_no(count,str);
}
show_mean1(ndig,str);
for(i=0;i<=SAMPLES;I++)
{
xi=X1;
xi=X2;
xi=X3;
xi=X4;
yd=Yd;
J=(yd-Y_effect());
mean=mean+fabs(J);
}
show_train(str);
mean=mean/SAMPLES;
show_mean2(ndig,str);
init_bar();
train++;
}
FINISH:
draw_graph1();
getch();
fflush(stdin);
draw_graph2();
getch();
fflush(stdin);
setlinestyle(SOLID_LINE,0,BLUE);
contin=ask();
if(contin==l)
{cleardevice();
setbkcolor(LIGHTBLUE);
restore_screen(ptr);
goto BB;
}
closegraph();
save_pad();
test_sample();
cout<<"THe program is finised";
return OK;
}

frogfish 发表于 2007-12-5 16:15

是程序提示有错误还是结果不合理?
页: [1]
查看完整版本: 求助:模糊系统、模糊神经网络及应用程序设计例子什么不对