首页 > 其他 > 详细

神经网络rbf

时间:2016-12-05 23:10:34      阅读:166      评论:0      收藏:0      [点我收藏+]
clc;
clear;
close all;

ld=400; %定义学习样本的数量
x=rand(2,ld); %得到一个2 * 400的一个矩阵,每个元素在0-1之间
x=(x-0.5)*1.5*2; %-1.5, 1.5
x1=x(1,:); %得到矩阵的第1行
x2=x(2,:); %得到矩阵的第2行
F=20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2); %定义样本输出


%训练网络
net=newrb(x,F);

%generate the testing data
interval=0.1;
[i, j]=meshgrid(-1.5:interval:1.5);
row=size(i); 
tx1=i(:); %列矩阵
tx1=tx1‘; %变为行矩阵
tx2=j(:);
tx2=tx2‘;
tx=[tx1;tx2]; %2 * n的矩阵 ,作为测试网络的输入数据

%testing
ty=sim(net,tx); %调用网络,得到对应的输出结果
% 画出网络得到的结果
v=reshape(ty,row);
figure
subplot(1,3,2)
mesh(i,j,v);
zlim([0,60])

%plot the original function
interval=0.1;
[x1, x2]=meshgrid(-1.5:interval:1.5);
F = 20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);
subplot(1,3,1)
mesh(x1,x2,F);
zlim([0,60])

%plot the error
subplot(1,3,3)
mesh(x1,x2,F-v);
zlim([0,60])

 技术分享

神经网络rbf

原文:http://www.cnblogs.com/TheoryDance/p/6135627.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!