clear all;
clc;
u=1:1:90;
y0=u'.^(-1);
eff=1.8; %Learning efficient
q=100; %Quantification level
c=5; %Activate c neurons at once
number=5; %number is the divisor for calculating the spurious encoding
min=-0.1;
max=0.9;
w=zeros(number,1); %Build a random weight matrix
w1=w;
dw=w;
for p=1:length(u)
M(p)=round((u(p)-min)*q/(max-min)); %Input u is quantized
% M(p)= pi/10*[sin(p)+0.3*sin(3*p)];
sum=0;
for i=1:c
A(i)=mod(M(p)+i,number)+1; %Finding Stray Addresses
sum=sum+w(A(i)); %Find weights and
end
for step=1:100
y(p)=sum ;%CMAC output
e(p)=y0(p)-y(p);
E(p)=e(p)^2/2 ;%Objective function
dw=eff*e(p)/c ;%Weight increment
for i=1:c
A(i)=mod(M(p)+i,number)+1;
w(A(i))=w1(A(i))+dw ;%Adjust the weight value
end
end
w1=w;
end
figure(1); %Figure 1 plots the expected output and the actual output
plot(1:length(u),y0,'g');
hold on;
plot(1:length(u),y,'r');
figure(2); %Figure 2 Draws the error curve
plot(1:length(u),e,'r');
e
寒泊
- 粉丝: 86
- 资源: 1万+
最新资源
- 案例分析:研发人员绩效和薪酬管理的困境.doc
- 企业中薪酬管理存在的问题分析及对策.doc
- 员工年度薪酬收入结构分析报告.doc
- 薪酬分析报告.docx
- 西门子S7-1200控制四轴伺服程序案例: 1.内容涵盖伺服,步进点动,回原,相对定位,绝对定位,速度模式控制 特别适合学习伺服和步进的朋友们 PTO伺服轴脉冲定位控制+速度模式控制+扭矩模式; 2
- 企业公司薪酬保密协议.doc
- 薪酬保密制度 (1).docx
- 薪酬保密管理规定制度.doc
- 薪酬保密制度.docx
- 薪酬保密协议书.docx
- 薪酬保密承诺书.docx
- 薪酬管理制度.doc
- 员工工资薪酬保密协议.docx
- 员工工资保密暂行管理条例.docx
- 员工薪酬保密协议.doc
- 1Redis基础认识与安装.html
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈