summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m43
1 files changed, 43 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m
new file mode 100755
index 0000000..3c67d8b
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m
@@ -0,0 +1,43 @@
1% lplot(VEC, XRANGE)
2%
3% Plot VEC, a vector, in "lollipop" format.
4% XRANGE (optional, default = [1,length(VEC)]), should be a 2-vector
5% specifying the X positions (for labeling purposes) of the first and
6% last sample of VEC.
7
8% Mark Liberman, Linguistics Dept, UPenn, 1994.
9
10function lplot(x,xrange)
11
12if (exist('xrange') ~= 1)
13 xrange = [1,length(x)];
14end
15
16msize = size(x);
17if ( msize(2) == 1)
18 x = x';
19elseif (msize(1) ~= 1)
20 error('First arg must be a vector');
21end
22
23if (~isreal(x))
24 fprintf(1,'Warning: Imaginary part of signal ignored\n');
25 x = abs(x);
26end
27
28N = length(x);
29index = xrange(1) + (xrange(2)-xrange(1))*[0:(N-1)]/(N-1)
30xinc = index(2)-index(1);
31
32xx = [zeros(1,N);x;zeros(1,N)];
33indexis = [index;index;index];
34xdiscrete = [0 xx(:)' 0];
35idiscrete = [index(1)-xinc indexis(:)' index(N)+xinc];
36
37[mn,mx] = range2(xdiscrete);
38ypad = (mx-mn)/12; % MAGIC NUMBER: graph padding
39
40plot(idiscrete, xdiscrete, index, x, 'o');
41axis([index(1)-xinc, index(N)+xinc, mn-ypad, mx+ypad]);
42
43return