编程 没有图。请问各位大佬这是为什么!!!
clear all;
close all;
xite=0.50;
ts=0.00001;t2=0.002;
pi=3.1415926;
w=0.1*ones(1,5);
w_1=w;
h=zeros(5,1);
c1=[-pi/540 -pi/1080 0 pi/1080 pi/540];
c2=[-1 -0.5 0 0.5 1];
b1=pi/540;b2=0.5;
NS=1000;
for s=1:1:NS
u(s)=-0.005+s*ts;
y(s)=-1+s*t2;
f2(s)=197.3224-27.6946*u(s)+48.2127*y(s)+6.6399*10.^(-2)*u(s)*y(s);
end
for k=1:1:500
k=k+1;
times(k)=k;
for s=1:1:NS
for j=1:1:5
h(j)=exp(-((u(s)-c1(:,j))^2/(2*b1^2))+((y(s)-c2(:,j))^2/(2*b2^2)));
end
yl(s)=w*h;
el=0.5*(f2(s)-yl(s))^2;
es(s)=el;
E=0;
if s==NS
for s=1:1:NS
E=E+es(s);
end
end
error=f2(s)-yl(s);
dw=xite*h'*error;
w=w_1+dw;
w_1=w;
end
Ek(k)=E;
end
figure(1);
plot(times,Ek,'r','linewidth',2);