Information Technology Reference
In-Depth Information
s seen, the program requires several additional .M files. The neigh1.m or
neigh2.m files specify indexes of the cells in the neighborhood to be later used by
files like proj2s5.m which evaluates the projection according to the specified fam-
ily label (note the syntax proj
typ.m of the projection file).
The files specifying the neighborhoods are presented bellow as well as two
examples of projection files:
%neigh1.m
jr=[2:n,1]; % right cells
jrr=[3:n,1:2];
jrrr=[4:n,1:3];
jrrrr=[5:n,1:4];
%neigh2.m
jr=[2:n,1];
% right cells
jl=[n,1:n-1];
% left cells
id=[2:m,1];
% upper cells
iu=[m,1:m-1];
% lower cells
jl=[n,1:n-1]; % left cells
jll=[n-1,n,1:n-2];
jlll=[n-2,n-1,n,1:n-3];
jllll=[n-3,n-2,n-1,n,1:n-4];
% proj2s5
sigm=5*(x0);
% proj1s5
sigm=5*x0(i,j);
sigm=sigm+x0(i,jr);
sigm=sigm+x0(i,jl);
sigm=sigm+x0(id,j);
sigm=sigm+x0(iu,j);
sigm=sigm+x0(i,jll);
sigm=sigm+x0(i,jl);
sigm=sigm+x0(i,jr);
sigm=sigm+x0(i,jrr);
L implementation of the
relationship between output and projection (enc oded in Table 3.2). The first, entitled
offset_cell.m computes an offset z according to (3.) and is external to the main
Other two files are in relation with the canonical P
loop, while the second ( out_cell.m ) updates the cell outputs according to (3.) and
it is included in the main loop. Choosing a different form of cell implementation
requires changing only of these two files.
%offset_cell.m
ntr=size(tr,2); mm=ntr-1;
z=0.5*(tr(2:ntr)+tr(1:ntr-1));
% out_cell.m
w=w0;
if mod(ntr,2)==1 w=w0-s*sigm; end
for k=1:mm
w0=0;
if mod(ntr,2)==1 w0=w0+s*tr(1); end
for i=1:mm
w0=w0+s*((-1)^i)*abs(tr(1)-z(i));
end
w=w-s*((-1)^k)*abs(sigm-z(k));
end
if dig==1 x0=(sign(w)+1)/2;
else
x0=(0.5*(abs(w+1)-abs(w-1))+1)/2;
end
Search WWH ::




Custom Search