Mercurial > hg > smallbox
comparison util/classes/@dictionary/dictionary.m @ 184:8fc38e8df8c6 danieleb
Minor edits
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Fri, 27 Jan 2012 13:18:50 +0000 |
parents | e3035d45d014 |
children |
comparison
equal
deleted
inserted
replaced
183:0d7a81655ef2 | 184:8fc38e8df8c6 |
---|---|
29 obj.name = 'explicit'; | 29 obj.name = 'explicit'; |
30 else | 30 else |
31 switch lower(phi) | 31 switch lower(phi) |
32 case 'dct' | 32 case 'dct' |
33 obj.phi = dctmatrix(len,nAtoms); | 33 obj.phi = dctmatrix(len,nAtoms); |
34 case 'grassmanian' | 34 case 'grassmannian' |
35 obj.phi = grassmanian(len,nAtoms); | 35 obj.phi = grassmanian(len,nAtoms); |
36 otherwise | 36 otherwise |
37 obj.phi = MatrixEnsemble(len,nAtoms,phi); | 37 obj.phi = MatrixEnsemble(len,nAtoms,phi); |
38 end | 38 end |
39 obj.len = len; | 39 obj.len = len; |
40 obj.nAtoms = nAtoms; | 40 obj.nAtoms = nAtoms; |
41 obj.name = lower(phi); | 41 obj.name = lower(phi); |
42 end | 42 end |
43 end | 43 end |
44 end | 44 end |
45 | |
46 %% Dependent properties | 45 %% Dependent properties |
47 function redundancy = get.redundancy(obj) | 46 function redundancy = get.redundancy(obj) |
48 redundancy = obj.nAtoms/obj.len; | 47 redundancy = obj.nAtoms/obj.len; |
49 end | 48 end |
50 function coherence = get.coherence(obj) | 49 function coherence = get.coherence(obj) |
61 r = rank(obj.phi); | 60 r = rank(obj.phi); |
62 end | 61 end |
63 %% Operations | 62 %% Operations |
64 function obj = normalize(obj) | 63 function obj = normalize(obj) |
65 obj.phi = normcol(obj.phi); | 64 obj.phi = normcol(obj.phi); |
66 end | 65 end |
67 | |
68 %% Visualization | 66 %% Visualization |
69 function image(obj) | 67 function image(obj) |
70 %Image of the dictionary | 68 %Image of the dictionary |
71 if isreal(obj.phi) | 69 if isreal(obj.phi) |
72 imagesc(obj.phi); | 70 imagesc(obj.phi); |
99 title(['Atom number ' num2str(n) '/' num2str(size(obj.phi,2)) ' - Real']); | 97 title(['Atom number ' num2str(n) '/' num2str(size(obj.phi,2)) ' - Real']); |
100 subplot(2,1,2) | 98 subplot(2,1,2) |
101 plot(imag(obj.phi(:,n))); | 99 plot(imag(obj.phi(:,n))); |
102 title(['Atom number ' num2str(n) '/' num2str(size(obj.phi,2)) ' - Imaginary']); | 100 title(['Atom number ' num2str(n) '/' num2str(size(obj.phi,2)) ' - Imaginary']); |
103 end | 101 end |
104 end | 102 end |
105 | |
106 function movie(obj) | 103 function movie(obj) |
107 %Movie of the basis | 104 %Movie of the basis |
108 for i=1:size(obj.phi,2) | 105 for i=1:size(obj.phi,2) |
109 obj.plot(i); | 106 obj.plot(i); |
110 pause(1/25); | 107 pause(1/25); |