永利皇宫官网网址

网站最新上线:http://www.hslogic.com/

基于RBF神经网络的线性规划仿真

上一篇 / 下一篇  2018-10-20 07:01:45

%clc
clear
close all

n1 = 1:2:200;
x1 = sin(n1*0.1);

n2 = 2:2:200;
x2 = sin(n2*0.1);

xn_train = n1;          
dn_train = x1;         
xn_test = n2;          
dn_test = x2;          

%---------------------------------------------------

switch 1
case 1
        

P = xn_train;
T = dn_train;
spread = 40;                
net = newrbe(P,T,spread);

case 2
    
P = xn_train;
T = dn_train;
goal = 1e-12;               
spread = 40;                
MN = size(xn_train,2);      
DF = 1;                     
net = newrb(P,T,goal,spread,MN,DF);

case 3
    
P = xn_train;
T = dn_train;
spread = 0.5;               
net = newgrnn(P,T,spread);
    
end

err1 = sum((dn_train-sim(net,xn_train)).^2)     

X = sim(net,xn_test);                          
err2 = sum((dn_test-X).^2)                     

%---------------------------------------------------

plot(1:length(n2),x2,'r+:',1:length(n2),X,'bo:')
title('+为真实值,o为预测值')

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar