[ea1ce1]: blockproc / blockplot.m  Maximize  Restore  History

Download this file

74 lines (61 with data), 2.1 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
function cola=blockplot(p,F,c,cola)
%BLOCKPLOT Plot block coefficients
% Usage: blockplot(p,F,c);
%
% Input parameters:
% p : JAVA object of the class net.sourceforge.ltfat.SpectFrame.
% F : Frame object.
% c : Block coefficients.
% cola : (Optional) overlap from previous block.
%
% Output parameters:
% cola : Overlap to the next block.
%
% `blockplot(p,F,c)` appends the block coefficients `c` to the running
% coefficient plot in `p`. The coefficients must have been obtained by
% `c=blockana(F,...)`. The format of `c` is changed to a rectangular
% layout according to the type of `F`.
%
% `blockplot(p,[],c)` does the same, but expects `c` to be already
% formatted matrix of real numbers. The matrix dimensions are not
% restricted, but it will be shrinked or expanded to a vertical
% strip in the sliding image.
%
% `cola=blockplot(p,F,c,cola)` does the same, but adds `cola` to the
% first respective coefficients in `c` and returns last coefficients from
% `c`. This is only relevant for the sliced window blocking approach.
%
if ~isempty(F)
ctf = framecoef2tf(F,c(:,1));
if size(c,2)>1
error('%s: Only one channel input is supported.',upper(mfilename));
end
if strcmp(F.blockalg,'sliced')
% DO the coefficient overlapping or cropping
%ctf = ctf(:,floor(end*3/8):floor(end*5/8)+1);
if nargin>3
olLen = ceil(size(ctf,2)/2);
if isempty(cola)
cola = zeros(size(ctf,1),olLen,class(ctf));
end
ctf(:,1:olLen) = ctf(:,1:olLen) + cola;
cola = ctf(:,end+1-olLen:end);
ctf = ctf(:,1:olLen);
end
end
ctf = abs(ctf);
else
if ~isreal(c)
error('%s: Complex values are not supported',upper(mfilename));
end
ctf = c;
end
if isoctave
% The JAVA 2D-array handling is row-major
ctf = cast(ctf,'double').';
javaMethod('append',p,ctf(:),size(ctf,2),size(ctf,1));
else
% Matlab casts correctly
ctf = cast(ctf,'single');
javaMethod('append',p,ctf);
end

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks