SourceForge has been redesigned. Learn more.
Close

[8d7bed]: / frames / framelengthcoef.m  Maximize  Restore  History

Download this file

29 lines (24 with data), 909 Bytes

 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
function L=framelengthcoef(F,Ncoef);
%FRAMELENGTHCOEF Frame length from coefficients
% Usage: L=framelengthcoef(F,Ncoef);
%
% `framelengthcoef(F,Ncoef)` returns the length of the frame *F*, such that
% *F* is long enough to expand the coefficients of length *Ncoef*.
%
% If instead a signal is given, call |framelength|.
%
% See also: frame, framelength
if nargin<2
error('%s: Too few input parameters.',upper(mfilename));
end;
if ~isscalar(Ncoef)
error('%s: Ncoef must be a scalar.',upper(mfilename));
end;
L = F.lengthcoef(Ncoef);
assert(abs(L-round(L))<1e-3,'%s: There is a bug. L=%d should be an integer.',upper(mfilename),L);
L=round(F.lengthcoef(Ncoef));
% Verify the computed length
if ~(L==framelength(F,L))
error(['%s: The coefficient number given does not correspond to a valid ' ...
'set of coefficients for this type of frame.'],upper(mfilename));
end;