我正在尝试使用径向基网络近似各种信号。 特别是,我利用了MATLAB的newrb 。
我的问题是,如果我按照newrb的描述 ,此功能的行为似乎不正确。 据我了解,尽管有文档,但转置所有参数还是有意义的。
以下示例有望说明我的问题。
我用100个样本创建一个正弦波周期。 我想通过带有最多两个隐藏神经元的径向基网络来近似此正弦波。 我有一个输入向量( t )和一个目标向量( s )。 因此,根据文档,我应该用两个列向量调用newrb 。 但是,近似值太好了。 实际上,均方误差为0,仅使用两个神经元就不能成立。 此外,如果使用列向量,带有view(net)的可视化view(net)不仅显示一个输入,而且显示100个输入。
在示例中,对应于“正确”(根据文档)函数调用的向量由_doc指示,对应于“不正确”调用的_not_doc由_not_doc 。
有人可以解释这种行为吗?
% one period sine signal with
% carrier frequency = 1, sampling frequency = 100
Ts = 1 / 100;
t = 2 * pi * (0:Ts:1-Ts); % size(t) = 1 100
s = sin(t); % size(s) = 1 100
% design radial basis network
MSE_goal = 0.0; % mean squared error goal, default value
spread = 1.0; % spread of readial basis functions, default value
max_neurons = 2; % maximum number of neurons, custom value
DF = 25; % number of neurons to add between displays, default value
net_not_doc = newrb( t , s , MSE_goal, spread, max_neurons, DF ); % row vectors
net_doc = newrb( t', s', MSE_goal, spread, max_neurons, DF ); % column vectors
% simulate network
approx_not_doc = sim( net_not_doc, t );
approx_doc = sim( net_doc, t' );
% plot
figure;
plot( t, s, 'DisplayName', 'Sine' );
hold on;
plot( t, approx_not_doc, 'r:', 'DisplayName', 'Approximation_{not doc}');
hold on;
plot( t, approx_doc', 'g:', 'DisplayName', 'Approximation_{doc}');
grid on;
legend show;
% view neural networks
view(net_not_doc);
view(net_doc);