%%%%%%%%%%%%%%%%%%% 初始化 %%%%%%%%%%%%%%%%%5
clear all;
close all;
G=10000;
N=10;
w=2.5*(1-2.*rand(N,1));
%ci=1-(2.*rand(2,10));
ci=3.*(1-(2.*rand(2,10)));
di=0.5.*rand(1,10);
E=0;
%%%%%%%%%%%%%%%%%%% 非线性系统 %%%%%%%%%%%%%%%%%%%%%%
%u1=2.*(1-2.*rand(1,800));
y_1=0;
ts=0.2;
%testx(3,10000)=0;
for k=1:1:G
time(k)=k*ts;
u1(k)=1.0*(cos(2*pi*k*ts/250));
%u1(k)=3.25-3*square((2*pi/150)*k);
yout1(k)=1.5*y_1/(1+y_1^2)+0.3*cos(y_1)+1.2*u1(k);
%u_1=u1(k);
%y_1=yout1(k);
%testx(:,k)=[u1(k);yout1(k);y_1];
u_1=u1(k);
y_1=yout1(k);
end
testx=[u1;yout1];
%%%%%%%%%%%%%%%%%%%% 训练开始 %%%%%%%%%%%%%%%%%%%%%
for k=1:1:G
for j=1:1:10
h(j)=exp(-norm(testx(:,k)-ci(:,j))^2/(2*di(j)*di(j)));
end
ymout1(k)=h*w;
%%%%%%%%%%%%%%%%%%%%%% 参数的调整 %%%%%%%%%%%%%%%%%%%%
d_w=0;
for j=1:1:N
d_w(j,1)=0.2.*(yout1(k)-ymout1(k))*h(j);
end
w=w+d_w;
d_di=0;
for j=1:1:N
d_di(j)=0.2.*(yout1(k)-ymout1(k))*w(j)*h(j)*(di(j)^-3)*norm(testx(:,k)-ci(:,j))^2;
end
di=di+d_di;
for j=1:1:N;
for i=1:1:2;
d_ci(i,j)=0.2.*(yout1(k)-ymout1(k))*w(j)*h(j)*(testx(i,k)-ci(i,j))*(di(j)^-2);
end
end
ci=ci+d_ci;
end
%figure(1);
%plot(time,yout1,'r',time,ymout,'b');
%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试 %%%%%%%%%%%%%%%%%%%%%%%%%5
y_2=0;
ts=0.1;
for k=1:1:G
time(k)=k*ts;
u(k)=1.0*(cos(2*pi*k*ts/250));
%u(k)=3.25-3*square((2*pi/150)*k);
yout(k)=1.5*y_1/(1+y_1^2)+0.3*cos(y_1)+1.2*u(k);
%x(:,k)=[u(k);yout(k);y_2];
u_1=u(k);
y_1=yout(k);
end
x=[u;yout];
for k=1:1:G
for j=1:1:N
h(j)=exp(-norm(x(:,k)-ci(:,j))^2/(2*di(j)*di(j)));
end
ymout(k)=h*w;
end
for k=1:1:G
error(k)=yout(k)-ymout(k);
E=E+error(k);
end
E=abs(E)/G;
figure(1);
plot(time,yout,'r',time,ymout,'b')
alvarocfc
- 粉丝: 134
- 资源: 1万+
最新资源
- MATLAB 实现基于双向长短期记忆网络(BiLSTM)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- 基于java的校园一卡通系统软件的开题报告.docx
- MATLAB 实现基于灰色预测模型(Grey Prediction)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- 基于Pygame库的Python烟花效果编程教程与应用
- MATLAB 实现基于小波变换(Wavelet Transform)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- 元旦烟花HTML实现:使用Canvas和JS打造炫酷的网页烟花效果
- Python实现文字、数字与公式识别及其CNN模型训练的技术指南-含代码
- 資訊安全與生活.docx
- 动态云背景导航页源码.zip
- IMG_20250102_080841.jpg
- 基于Java+JSP+MySQL实现个人与家乡展示管理平台源码(高分项目)
- 基于STM32的智能温室大棚控制系统设计(源码+报告文档)
- 基于STM32的智能温室大棚控制系统设计源码+报告+答辩PPT(高分项目)
- 毕业设计基于STM32单片机的智能空气监测系统源码+文档说明(高分毕设)
- 基于python的自动组卷评卷考试系统源码.zip
- 基于python的自动组卷评卷考试系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈