comparison m-toolbox/test/test_ao_gnuplot.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % A test script from ao/gnuplot
2 %
3 % M Hewitson 26-02-2010
4 %
5 % $Id: test_ao_gnuplot.m,v 1.2 2010/03/01 09:19:06 hewitson Exp $
6 %
7
8 clear all;
9
10 %% Time-series
11
12 a1 = ao(plist('tsfcn', 'sin(2*pi*t)', 'fs', 10000, 'nsecs', 10, 'yunits', 'm^2 V^-0.5'))
13 a1.setName('My Nice AO 1');
14 a1.setPlotinfo(plist('color', 'b', 'linewidth', 6, 'linestyle', '--', 'marker', ''));
15
16 a2 = ao(plist('tsfcn', 'sin(2*pi*0.5*t)', 'fs', 3000, 'nsecs', 10, 'yunits', 'm^2 V^-0.5'))
17 a2.setName('My Nice AO 2');
18 a2.setPlotinfo(plist('color', [0.2 0.2 0.2], 'linewidth', 2, 'linestyle', '-', 'marker', ''));
19
20 %% Plot
21
22 outfile = 'test.pdf';
23 fnames = gnuplot(a1, a2, plist('terminal', 'pdf enhanced', ...
24 'output', outfile, ...
25 'preamble', {'set title "my nice plot"', 'set key outside top right'}, ...
26 'markerscale', 3))
27
28 cmd = sprintf('open %s', fnames{1});
29 system(cmd)
30
31
32 %% Subplots
33
34 outfile = 'test.pdf';
35
36 fnames = gnuplot(a1, a2, plist('arrangement', 'subplots', 'terminal', 'pdf enhanced', ...
37 'output', outfile, ...
38 'preamble', {'set title "my nice plot"', 'set key outside top right'}, ...
39 'markerscale', 3))
40
41 cmd = sprintf('open %s', fnames{1});
42 system(cmd)
43
44
45 %% Single plots
46
47 outfile = 'test.pdf';
48
49 fnames = gnuplot(a1, a2, plist('arrangement', 'single', 'terminal', 'pdf enhanced', ...
50 'output', outfile, 'outdir', '.', ...
51 'preamble', {'set title "my nice plot"', 'set key outside top right'}, ...
52 'markerscale', 3))
53
54 for jj=1:numel(fnames)
55 cmd = sprintf('open %s', fnames{jj});
56 system(cmd)
57 end
58
59 %% Frequency-series
60
61 a = ao(plist('tsfcn', 'randn(size(t))', 'fs', 100, 'nsecs', 100));
62 axx = a.lpsd;
63
64 pzm = pzmodel(1, 1, 10);
65 bxx = pzm.resp(plist('fs', logspace(-1,2,1000)));
66
67
68 %% Single plots
69 outfile = 'test.pdf';
70
71 fnames = gnuplot(axx,bxx, plist('arrangement', 'single', 'terminal', 'pdf enhanced', ...
72 'output', outfile, 'outdir', '.', ...
73 'preamble', {'set title "my nice plot"', 'set key outside top right', ...
74 'unset logscale', 'set logscale x'}, ...
75 'markerscale', 3))
76
77 for jj=1:numel(fnames)
78 cmd = sprintf('open %s', fnames{jj});
79 system(cmd)
80 end
81
82 %% Stacked
83
84 outfile = 'test.pdf';
85
86 fnames = gnuplot(axx,bxx, plist('arrangement', 'stacked', 'terminal', 'pdf enhanced', ...
87 'output', outfile, 'outdir', '.', ...
88 'preamble', {'set title "my nice plot"', 'set key outside top right'}, ...
89 'markerscale', 3))
90
91 for jj=1:numel(fnames)
92 cmd = sprintf('open %s', fnames{jj});
93 system(cmd)
94 end
95
96
97
98