?? drawnn.m
字號:
%#
%# function drawnn(topo,w1,w2)
%#
%# AIM: Draws the topology of a neural network. (Called in nnmodel.m)
%#
%# INPUT: topo (2 x nh) : matrix containing structure of the NN (nh hidden nodes)
%# (H: hyperbolic tangent, L: linear, -: no function)
%# w1 (nh x (p+1)) : matrix of weights between input-hidden layer
%# (p: number of input variables)
%# w2 (1 x (nh+1)) : matrix of weights between hidden-output layer
%#
%# AUTHOR: Programmed by : Claus Svarer, EI/CONNECT &
%# Magnus Norgaard, IAU/EI/IMM (1994)
%# Neural Network-Based System Identification Toolbox
%# Web site : http://www.iau.dk/Projects/proj/nnsysid.html
%#
%# Modified by Frederic Despagne
%# Copyright(c) 1998 for ChemoAC
%# Dienst FABI, Vrije Universiteit Brussel
%# Laarbeeklaan 103, 1090 Jette
%#
%# VERSION: 1.1 (28/02/1998)
%#
function drawnn(topo,w1,w2)
close
[N1,N0] = size(w1);
N0 = N0-1;
N2 = length(find(topo(2,:)~='-'));
MaxNeu = max([N0 N1 N2]);
cla
LengthTres = 0.025*MaxNeu;
axis([-0.1 2.1 0.5 MaxNeu+0.5]);
axis('off')
hold on;
for i = 1:N0,
plot(0,(MaxNeu/(N0+1))*i,'co');
text(-0.1,(MaxNeu/(N0+1))*i-0.0,sprintf('%g',i));
end;
for i = 1:N1,
plot(1,(MaxNeu/(N1+1))*i,'co');
if topo(1,i) == 'L'
plot([1 1],[((MaxNeu/(N1+1))*i-LengthTres) ((MaxNeu/(N1+1))*i+LengthTres)],'c');
end
end;
for i = 1:N2,
plot(2,(MaxNeu/(N2+1))*i,'co');
if topo(2,i) == 'L'
plot([2 2],[((MaxNeu/(N2+1))*i-LengthTres) ((MaxNeu/(N2+1))*i+LengthTres)],'c');
end
end;
for i = 1:N0,
for j = 1:N1,
plot([0 1],[(MaxNeu/(N0+1))*i (MaxNeu/(N1+1))*j],'c');
end;
end
for i = 1:N1,
for j = 1:N2,
plot([1 2],[(MaxNeu/(N1+1))*i (MaxNeu/(N2+1))*j],'c');
end;
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -