请高人 给我个rbf神经网络 源程序, 最好是用遗传算法改进过的。
不甚感激。
请发至:[email protected]

解决方案 »

  1.   

    clc;
    clear;
    close all;%  generate the learing data
    ld=400; %学习数据的个数
    x=rand(2,ld); % 在 0-1 之间随机产生2*ld的数据在矩阵中
    x=(x-0.5)*1.5*2; %-1.5, 1.5   为了画图把它转变到【-1.5 1.5】之间
    x1=x(1,:);
    x2=x(2,:);
    F=20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2); %为了试验,自己产生的数据
    % RBF开始了!!!%生成网络
    net=newrb(x,F);  % x为输入,F为输出,这个函数会自己训练!!!!%下面是怎么应用网络的问题!!!!%generate the testing data
    interval=0.1;
    [i, j]=meshgrid(-1.5:interval:1.5);% meshgird产生的是方框数据
    row=size(i);
    tx1=i(:);
    tx1=tx1';
    tx2=j(:);
    tx2=tx2';
    tx=[tx1;tx2];
    %以上为产生测试数据 tx% 画图对比神经网络的结果和实际输出结果的差异%testing 实践测试  ty 为神经网络的结果
    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); % F为实际计算的结果
    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])%  怎么提高结果