www.gusucode.com > nnet 案例源码 matlab代码程序 > nnet/UgErrorNormExample.m

    %% UgErrorNorm
% This example shows 
%% setup

% Copyright 2015 The MathWorks, Inc.

x = -1:0.01:1;
t1 = 100*sin(x);
t2 = 0.01*cos(x);
t = [t1; t2];

%% randomseed
rng(0) % hidden code

%% trainDefault
net = feedforwardnet(5);
net1 = train(net,x,t);
y = net1(x);

%% figure1
figure(1)
plot(x,y(1,:),x,t(1,:))

%% figure2
figure(2)
plot(x,y(2,:),x,t(2,:))

%% trainNorm
net.performParam.normalization = 'standard';
net2 = train(net,x,t);
y = net2(x);

%% figure3
figure(3)
plot(x,y(1,:),x,t(1,:))

%% figure4
figure(4)
plot(x,y(2,:),x,t(2,:))