[249cf9]: gabor / gabframebounds.m  Maximize  Restore  History

Download this file

129 lines (101 with data), 3.2 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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
function [AF,BF]=gabframebounds(g,a,M,varargin)
%GABFRAMEBOUNDS Calculate frame bounds of Gabor frame
% Usage: fcond=gabframebounds(g,a,M);
% [A,B]=gabframebounds(g,a,M);
% [A,B]=gabframebounds(g,a,M,L);
% [A,B]=gabframebounds(g,a,M,'lt',lt);
%
% Input parameters:
% g : The window function.
% a : Length of time shift.
% M : Number of channels.
% L : Length of transform to consider.
% lt : Lattice type (for non-separable lattices).
% Output parameters:
% fcond : Frame condition number (B/A)
% A,B : Frame bounds.
%
% `gabframebounds(g,a,M)` calculates the ratio $B/A$ of the frame bounds
% of the Gabor system with window *g*, and parameters *a*, *M*.
%
% `[A,B]=gabframebounds(...)` returns the frame bounds *A* and *B*
% instead of just the ratio.
%
% The window *g* may be a vector of numerical values, a text string or a
% cell array. See the help of |gabwin| for more details.
%
% `gabframebounds(g,a,M,L)` will cut or zero-extend the window to length
% *L*.
%
% `gabframebounds(g,a,M,'lt',lt)` does the same for a non-separable
% lattice specified by *lt*. Please see the help of |matrix2latticetype|
% for a precise description of the parameter *lt*.
%
% See also: gabrieszbounds, gabwin
%% ---------- Assert correct input.
if nargin<3
error('%s: Too few input parameters.',upper(mfilename));
end;
definput.keyvals.L=[];
definput.keyvals.lt=[0 1];
[flags,kv,L]=ltfatarghelper({'L'},definput,varargin);
%% ------ step 2: Verify a, M and L
if isempty(L)
if isnumeric(g)
% Use the window length
Ls=length(g);
else
% Use the smallest possible length
Ls=1;
end;
% ----- step 2b : Verify a, M and get L from the window length ----------
L=dgtlength(Ls,a,M,kv.lt);
else
% ----- step 2a : Verify a, M and get L
Luser=dgtlength(L,a,M,kv.lt);
if Luser~=L
error(['%s: Incorrect transform length L=%i specified. Next valid length ' ...
'is L=%i. See the help of DGTLENGTH for the requirements.'],...
upper(mfilename),L,Luser);
end;
end;
%% ----- step 3 : Determine the window
[g,info]=gabwin(g,a,M,L,kv.lt,'callfun',upper(mfilename));
if L<info.gl
error('%s: Window is too long.',upper(mfilename));
end;
%% ----- actual computation ------------
g=fir2long(g,L);
R=size(g,2);
if kv.lt(2)==1
% Rectangular case
% Get the factorization of the window.
gf=comp_wfac(g,a,M);
% Compute all eigenvalues.
lambdas=comp_gfeigs(gf,L,a,M);
s=size(lambdas,1);
else
% Convert to multi-window
mwin=comp_nonsepwin2multi(g,a,M,kv.lt,L);
% Get the factorization of the window.
gf=comp_wfac(mwin,a*kv.lt(2),M);
% Compute all eigenvalues.
lambdas=comp_gfeigs(gf,L,a*kv.lt(2),M);
s=size(lambdas,1);
end;
% Min and max eigenvalue.
if a>M*R
% This can is not a frame, so A is identically 0.
AF=0;
else
AF=lambdas(1);
end;
BF=lambdas(s);
if nargout<2
% Avoid the potential warning about division by zero.
if AF==0
AF=Inf;
else
AF=BF/AF;
end;
end;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks