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
CMACsimple.rar_Cmac simple_Known_cmac
版权申诉
11 浏览量
2022-07-14
20:10:16
上传
评论
收藏 79KB RAR 举报
寒泊
- 粉丝: 76
- 资源: 1万+
最新资源
- 2406011243520696.mp4
- sql语句及应用场景.zip
- 疯狂吃月饼游戏小程序前端源码
- 硬件工程师+电子类工程师岗位简历模板
- 知识领域: 人工智能 技术关键词: TensorFlow、Keras、深度学习、神经网络
- 知识领域: 自动化测试 技术关键词: pytest、unittest、自动化测试、测试框架
- 知识领域: 数据库管理 技术关键词: SQLAlchemy、数据库、ORM、SQL 内容关键词: 数据库连接、数据查询、数据操作
- 知识领域: 网络编程 技术关键词: socket、网络编程、异步IO、TCP/IP 内容关键词: 客户端、服务器、网络协议
- 知识领域: 自然语言处理 技术关键词: NLTK、spaCy、文本处理、语言模型
- ubuntu20.04安装教程.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈