⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wnndemo.m

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 M
字号:
function retstr = wnndemo()
NNTWARN OFF

retstr=-1;
% 训练数据

% 输入
x = (-1:.05:1)';

% 输出
y = (-2.186 * x - 1.2864) .* (x < -0.2) ...
    + 4.246 * x             .* ((x >= -0.2) & (x < 0)) ...
    + (exp(-0.5 .* x - 0.5) .* sin((3 .* x + 7) .* x)) .* (x > 0);

% 绘制输入输出关系图
clf; plot(x,y,'o'); 
xlabel('x'); ylabel('y'); title('输入输出关系');

% 插值
% 可以在网络中设置小波数或者用FPE规则在线选择

% 训练过程
Key = keymenu('Make your choice','Use 9 wavelets','On-line choice');

if Key==1
  th = wnetreg(y, x, 9, 4, 3, 1, 5); 
  % Use 9 wavelets, 4 iterations, initialization mode 3,
  % minimum number of covered data points 1, scanned levels 5.
else
  th = wnetreg(y, x, [], 4, 3, 1, 5); 
end

% 对结果进行检测

% 对网络进行评价
xg = (-1:.01:1)';
yg = wavenet(xg, th);

% 绘制插值结果
plot(x,y,'o', xg,yg,':'); xlabel('x'); ylabel('y'); title('插值结果');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -