/
a54.tex
73 lines (67 loc) · 1.54 KB
/
a54.tex
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
72
73
\documentclass[border={10pt}]{standalone}
\usepackage{tikz,pgfplots,filecontents,amsmath}
\pgfplotsset{compat=1.5}
\begin{filecontents}{dataX.dat}
n xn
0 1.0
1 2.0
2 3.0
3 2.0
4 1.0
5 1.0
6 1.0
7 1.0
8 1.0
9 1.0
10 1.0
\end{filecontents}
\begin{filecontents}{dataY.dat}
n yn
0 2.0
1 1.0
2 2.0
3 -1.0
4 2.0
5 3.0
6 1.0
7 1.0
8 1.0
9 1.0
10 1.0
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axis x line=middle,
axis y line=middle,
every axis x label={at={(current axis.right of origin)},anchor=north west},
every axis y label={at={(current axis.above origin)},anchor= north west},
every axis plot post/.style={mark options={fill=black}},
xlabel={$n$},
ylabel={$\boldsymbol{x[n]}$},
xtick={0,2,...,10},
ymin=-1,
ymax=3,
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\addplot+[ycomb,black,thick] table [x={n}, y={xn}] {dataX.dat};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axis x line=middle,
axis y line=middle,
every axis x label={at={(current axis.right of origin)},anchor=north west},
every axis y label={at={(current axis.above origin)},anchor= north west},
every axis plot post/.style={mark options={fill=black}},
xlabel={$n$},
ylabel={$\boldsymbol{y[n]}$},
xtick={0,2,...,10},
ymin=-1,
ymax=3,
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\addplot+[ycomb,black,thick] table [x={n}, y={yn}] {dataY.dat};
\end{axis}
\end{tikzpicture}
\end{document}