📄 xnewgrnn.m
字号:
function xNewgrnn
% xNewgrnn.m
% 函数逼近(function approximation)--用函数NEWGRNN()和SIM()创建和仿真
% 普遍化回归神经网络(generalized regression neural network,GRNN)
%
% Author: HUANG Huajiang
% Copyright 2003 UNILAB Research Center,
% East China University of Science and Technology, Shanghai, PRC
% $Revision: 1.0 $ $Date: 2003/01/12 $
%
% [Ref] MATLAB demo, Mathworks Co.
clear all
clc
p = [1 2 3 4 5 6 7 8]; % inputs p
t = [0 1 2 3 2 1 2 1]; % target outputs t
spread = 0.7; % a smaller spread would fit data better but be less smooth.
net = newgrnn(p,t,spread); % 用NEWGRNN()一个普遍化回归神经网络
a = sim(net,p);
% 模拟计算网络对多个输入值的响应
cla reset
p2 = 0:.1:9;
a2 = sim(net,p2);
plot(p2,a2,'linewidth',3,'color',[1 0 0])
hold on
plot(p,t,'.','markersize',20)
axis([0 9 -1 4])
title('函数逼近')
xlabel('p 和 p2')
ylabel('t 和 a2')'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -