怎么查MATLAB中的newrbf,已经有了输入输出数据,如何在matlab中建立RBF神经网络
function t=net(p)
%%原始數據的輸入
clc,clear,close all
xingbiebili= [1.03 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.04 ? ? ? ? 1.04 ? ? ? ? 1.04 ? ? ? ? 1.01 ? ? ? ? 1.01 ? ? ? ? 1.00 ? ? ? ? 1.01 ? ? ? ? 1.00 ? ? ? ? 1.01 ? ? ? ? 1.01 ? ? ? ? 1.01 ? ? ? ? 1.00 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.09 ? ? ? ? 1.09 ? ? ? ? 1.09 ? ? ? ? 1.09 ? ? ? ? 1.09
];
%性別比例
lishi=[904.3? ? ? ? 919.2? ? ? ? 935? ? ? ? 950? ? ? ? 965? ? ? ? 981? ? ? ? 1028? ? ? ? 1047? ? ? ? 1061.00 ? ? ? ? 107500.00%? ? ? ? 1086? ? ? ? 1094? ? ? ? 1102? ? ? ? 1112? ? ? ? 1125? ? ? ? 1251.1? ? ? ? 1259.4? ? ? ? 1240? ? ? ? 1245.6? ? ? ? 1257.2? ? ? ? 1363.6? ? ? ? 1385.1? ? ? ? 1423.2? ? ? ? 1456.4? ? ? ? 1492.7
]
%歷史人口數量
renkoushuliang = [904.3? ? ? ? 919.2? ? ? ? 935? ? ? ? 950? ? ? ? 965? ? ? ? 981? ? ? ? 1028? ? ? ? 1047? ? ? ? 1061? ? ? ? 1075? ? ? ? 1086? ? ? ? 1094? ? ? ? 1102? ? ? ? 1112? ? ? ? 1125? ? ? ? 1251.1? ? ? ? 1259.4? ? ? ? 1240? ? ? ? 1245.6? ? ? ? 1257.2? ? ? ? 1363.6? ? ? ? 1385.1? ? ? ? 1423.2? ? ? ? 1456.4? ? ? ? 1492.7
];
%北京市人口數量 單位:萬人
p = [xingbiebili;chushenglv;siwanglv;ziranzengzhanglv;lishi];? ?%輸入數據矩陣
t = renkoushuliang;? ?? ?? ? %目標矩陣
%%歸一化處理
[pn,minp,maxp,tn,mint,maxt] = premnmx(p,t);??%對pt矩陣進行歸一化處理
dx = [-1,1;-1 1;-1,1;-1 1;-1 1];? ?? ?? ?? ?? ?? ?? ???%
%BP網絡訓練
net = newrb(pn,tn,0,20,5);
%%利用原始數據對BP網絡仿真
an = sim(net,pn);? ?? ?? ?? ?? ?? ???%用訓練好的模型進行仿真
a = postmnmx(an,mint,maxt);? ?? ?? ? %把仿真到的數據還原到原始的數量級
%%對比測試
x =1:25;
newk = a;
figure;
plot(x,newk,'r-o',x,renkoushuliang,'b--+');
legend('網絡輸出人口數量','實際人口數量');
xlabel('年份');
ylabel('人口數量/萬人');
title('模擬結果圖');
%利用訓練好的網絡進行預測
pnew = [1.03 ? ? ? ? 1.04 ? ? ? ? 1.03 ? ? ? ? 1.03 ? ? ? ? 1.04 ? ? ? ? 1.07 ? ? ? ? 1.06 ? ? ? ? 1.07
0.629? ? ? ? 0.622? ? ? ? 0.816? ? ? ? 0.789? ? ? ? 0.766? ? ? ? 0.727? ? ? ? 0.829? ? ? ? 0.905
0.52? ? ? ? 0.494? ? ? ? 0.483? ? ? ? 0.459? ? ? ? 0.433? ? ? ? 0.429? ? ? ? 0.427? ? ? ? 0.431
0.109? ? ? ? 0.128? ? ? ? 0.333? ? ? ? 0.33? ? ? ? 0.333? ? ? ? 0.298? ? ? ? 0.402? ? ? ? 0.474
1492.7? ? ? ? 1538.0? ? ? ? 1601.0? ? ? ? 1676.0? ? ? ? 1771.0? ? ? ? 1860.0? ? ? ? 1961.9? ? ? ? 2018.6
];
pnewn =tramnmx(pnew,minp,maxp);
%利用原始輸入數據的歸一化參數對新參數進行歸一化
anewn =sim(net,pnewn);
%利用歸一化后的數據進行仿真
yucejieguo =postmnmx(anewn,mint,maxt)
%把仿真得到的數據還原原始的數量級
figure
plot(yucejieguo)
參照這個代碼自己改一下就好了,很簡單
總結
以上是生活随笔為你收集整理的怎么查MATLAB中的newrbf,已经有了输入输出数据,如何在matlab中建立RBF神经网络的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用DNS 轻松获取主机信息
- 下一篇: J2EE WEBWORK FRAMEWO