Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{tikz}
- usepackage{pgfplots}
- pgfplotsset{compat=1.12}
- usepackage{pgfplotstable}
- usetikzlibrary{shapes.geometric, arrows,calc,decorations,decorations.pathreplacing,
- patterns,angles,quotes,intersections}
- begin{filecontents*}{data.txt}
- x y
- 1 2
- 2 4
- 3 6
- 4 8
- 5 10
- 6 12
- 7 14
- 8 16
- 9 18
- 10 20
- 20 20
- end{filecontents*}
- usepackage{calculator}
- LOG[10]{2.999}{loga}
- LOG[10]{5.001}{logb}
- begin{document}
- pgfplotstableread{data.txt}IGAIEdata
- pgfplotstableset{
- create on use/nepw_mod/.style={
- create col/copy column from table={data.txt}{nepw}
- }
- }
- begin{tikzpicture}
- begin{loglogaxis}[
- xlabel={$omega$},
- ylabel={Relative error},
- log basis x=10,
- /pgf/number format/precision=5
- ]
- % addplot[draw=none,forget plot] table[header=true,skip coords between index={0}{2}, skip coords between index={5}{12},
- %y={create col/linear regression}]{data.txt} coordinate [pos=0] (A) coordinate [pos=1] (B);
- addplot[draw=none,forget plot] table[header=true, restrict x to domain=loga:logb,
- y={create col/linear regression={y=y}}]{data.txt} coordinate [pos=0] (A) coordinate [pos=1] (B);
- %
- % addplot[draw=none,forget plot] table[header=true,skip first n=3,
- % y={create col/linear regression}]{data.txt} coordinate [pos=0] (A) coordinate [pos=1] (B);
- xdefslopea{pgfplotstableregressiona}
- draw (A) |- (B) node [pos=0.25,anchor=east]{pgfmathprintnumber{slopea}};
- addplot[green,mark=*] table{data.txt};
- addplot table[restrict x to domain=loga:logb]{data.txt};
- end{loglogaxis}
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement