diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/lplot.m | 43 |
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 | |||
10 | function lplot(x,xrange) | ||
11 | |||
12 | if (exist('xrange') ~= 1) | ||
13 | xrange = [1,length(x)]; | ||
14 | end | ||
15 | |||
16 | msize = size(x); | ||
17 | if ( msize(2) == 1) | ||
18 | x = x'; | ||
19 | elseif (msize(1) ~= 1) | ||
20 | error('First arg must be a vector'); | ||
21 | end | ||
22 | |||
23 | if (~isreal(x)) | ||
24 | fprintf(1,'Warning: Imaginary part of signal ignored\n'); | ||
25 | x = abs(x); | ||
26 | end | ||
27 | |||
28 | N = length(x); | ||
29 | index = xrange(1) + (xrange(2)-xrange(1))*[0:(N-1)]/(N-1) | ||
30 | xinc = index(2)-index(1); | ||
31 | |||
32 | xx = [zeros(1,N);x;zeros(1,N)]; | ||
33 | indexis = [index;index;index]; | ||
34 | xdiscrete = [0 xx(:)' 0]; | ||
35 | idiscrete = [index(1)-xinc indexis(:)' index(N)+xinc]; | ||
36 | |||
37 | [mn,mx] = range2(xdiscrete); | ||
38 | ypad = (mx-mn)/12; % MAGIC NUMBER: graph padding | ||
39 | |||
40 | plot(idiscrete, xdiscrete, index, x, 'o'); | ||
41 | axis([index(1)-xinc, index(N)+xinc, mn-ypad, mx+ypad]); | ||
42 | |||
43 | return | ||