[77a22a]: frames / frana.m  Maximize  Restore  History

Download this file

92 lines (82 with data), 2.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
function outsig=frana(F,insig);
%FRANA Frame analysis operator
% Usage: c=frana(F,f);
%
% `c=frana(F,f)` computes the frame coefficients *c* of the input
% signal *f* using the frame *F*. The frame object *F* must have been
% created using |frame|_ or |framepair|_.
%
% If *f* is a matrix, the transform will be applied along the columns
% of *f*. If *f* is an N-D array, the transform will be applied along
% the first non-singleton dimension.
%
% The output coefficients are stored as columns. This is usually
% **not** the same format as the 'native' format of the frame. As an
% examples, the output from |frana|_ for a gabor frame cannot be
% passed to |idgt|_ without a reshape.
%
% See also: frame, framepair, frsyn, plotframe
if nargin<2
error('%s: Too few input parameters.',upper(mfilename));
end;
if ~isstruct(F)
error('%s: First agument must be a frame definition structure.',upper(mfilename));
end;
switch(F.type)
case 'identity'
outsig=insig;
case 'gen'
outsig=F.g'*insig;
case 'dgt'
outsig=framenative2coef(F,dgt(insig,F.g,F.a,F.M,F.vars{:}));
case 'dgtreal'
outsig=framenative2coef(F,dgtreal(insig,F.g,F.a,F.M,F.vars{:}));
case 'dwilt'
outsig=framenative2coef(F,dwilt(insig,F.g,F.M));
case 'wmdct'
outsig=framenative2coef(F,wmdct(insig,F.g,F.M));
case 'filterbank'
outsig=framenative2coef(F,filterbank(insig,F.g,F.a));
case 'filterbankreal'
outsig=framenative2coef(F,filterbank(insig,F.g,F.a));
case 'ufilterbank'
outsig=framenative2coef(F,ufilterbank(insig,F.g,F.a));
case 'ufilterbankreal'
outsig=framenative2coef(F,ufilterbank(insig,F.g,F.a));
case 'nsdgt'
outsig=framenative2coef(F,nsdgt(insig,F.g,F.a,F.M));
case 'unsdgt'
outsig=framenative2coef(F,unsdgt(insig,F.g,F.a,F.M));
case 'nsdgtreal'
outsig=framenative2coef(F,nsdgtreal(insig,F.g,F.a,F.M));
case 'unsdgtreal'
outsig=framenative2coef(F,unsdgtreal(insig,F.g,F.a,F.M));
case {'dft',...
'dcti','dctii','dctiii','dctiv',...
'dsti','dstii','dstiii','dstiv'}
outsig=feval(F.type,insig);
case 'fusion'
% All frames must use the same length signal.
L=framelength(F,size(insig,1));
insig=postpad(insig,L);
coefs = cell(F.Nframes,1);
for ii=1:F.Nframes
coefs(ii)={F.w(ii)*frana(F.frames{ii},insig)};
end;
outsig=cell2mat(coefs);
case 'tensor'
999
size(insig)
outsig=frana(F.frames{1},insig);
size(outsig)
perm=[circshift((1:F.Nframes).',-1);
F.Nframes+1:ndims(insig)];
perm
for ii=2:F.Nframes
outsig=permute(outsig,perm);
size(outsig)
outsig=frana(F.frames{ii},outsig);
size(outsig)
end;
outsig=permute(outsig,perm);
end;