Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/netlab3.3/hintmat.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function [xvals, yvals, color] = hintmat(w); | |
2 %HINTMAT Evaluates the coordinates of the patches for a Hinton diagram. | |
3 % | |
4 % Description | |
5 % [xvals, yvals, color] = hintmat(w) | |
6 % takes a matrix W and returns coordinates XVALS, YVALS for the | |
7 % patches comrising the Hinton diagram, together with a vector COLOR | |
8 % labelling the color (black or white) of the corresponding elements | |
9 % according to their sign. | |
10 % | |
11 % See also | |
12 % HINTON | |
13 % | |
14 | |
15 % Copyright (c) Ian T Nabney (1996-2001) | |
16 | |
17 % Set scale to be up to 0.9 of maximum absolute weight value, where scale | |
18 % defined so that area of box proportional to weight value. | |
19 | |
20 w = flipud(w); | |
21 [nrows, ncols] = size(w); | |
22 | |
23 scale = 0.45*sqrt(abs(w)/max(max(abs(w)))); | |
24 scale = scale(:); | |
25 color = 0.5*(sign(w(:)) + 3); | |
26 | |
27 delx = 1; | |
28 dely = 1; | |
29 [X, Y] = meshgrid(0.5*delx:delx:(ncols-0.5*delx), 0.5*dely:dely:(nrows-0.5*dely)); | |
30 | |
31 % Now convert from matrix format to column vector format, and then duplicate | |
32 % columns with appropriate offsets determined by normalized weight magnitudes. | |
33 | |
34 xtemp = X(:); | |
35 ytemp = Y(:); | |
36 | |
37 xvals = [xtemp-delx*scale, xtemp+delx*scale, ... | |
38 xtemp+delx*scale, xtemp-delx*scale]; | |
39 yvals = [ytemp-dely*scale, ytemp-dely*scale, ... | |
40 ytemp+dely*scale, ytemp+dely*scale]; | |
41 |