📄 rbf.m
字号:
%% Radial Basis Approximation
% This demo uses the NEWRB function to create a radial basis network that
% approximates a function defined by a set of data points.
%
% Copyright 1992-2002 The MathWorks, Inc.
% $Revision: 1.14 $ $Date: 2002/03/29 19:36:06 $
%%
% Define 21 inputs P and associated targets T.
P = -1:.1:1;
T = [-.9602 -.5770 -.0729 .3771 .6405 .6600 .4609 ...
.1336 -.2013 -.4344 -.5000 -.3930 -.1647 .0988 ...
.3072 .3960 .3449 .1816 -.0312 -.2189 -.3201];
plot(P,T,'+');
title('训练样本');
xlabel('输入向量 P');
ylabel('目标向量 T');
%%
% The function NEWRB quickly creates a radial basis network which approximates
% the function defined by P and T. In addition to the training set and targets,
% NEWRB takes two arguments, the sum-squared error goal and the spread constant.
eg = 0.02; % sum-squared error goal
sc = 1; % spread constant
net = newrb(P,T,eg,sc);
%%
% To see how the network performs, replot the training set. Then simulate the
% network response for inputs over the same range. Finally, plot the results on
% the same graph.
plot(P,T,'+');
xlabel('输入');
X = -1:.01:1;
Y = sim(net,X);
hold on;
plot(X,Y);
hold off;
legend({'目标','输出'})
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -