Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. documentclass[border=2pt]{standalone}
  2. usepackage[utf8]{inputenc}
  3.  
  4. usepackage{graphics}
  5. usepackage{tikz,pgfplots}
  6. usetikzlibrary{math} % Pour evaluate
  7. usetikzlibrary{calc} % Pour postionnement relatif
  8.  
  9. newcommand*{addploZ}[2]{
  10. addplot[#2,samples=60,domain=0:Ttrace,thick=3pt,ultra thick,
  11. evaluate={ Tun = (1 / ( 6 *(#1-sqrt(#1^2 -1)) ));
  12. Tdeux = (1 / ( 6 *(#1+sqrt(#1^2 -1)) )); }
  13. ] { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-x/ Tun ) - Tdeux *exp(-x/ Tdeux ) )) };
  14. }
  15.  
  16. newcommand*{LegendArrows}[5]{
  17. pgfmathparse{(1 / ( 6 *(#1-sqrt(#1^2 -1)) ))} pgfmathresult letTunpgfmathresult
  18. pgfmathparse{(1 / ( 6 *(#1+sqrt(#1^2 -1)) ))} pgfmathresult letTdeuxpgfmathresult
  19. coordinate (C2) at (axis cs:#2, { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-#2/ Tun )
  20. - Tdeux *exp(-#2/ Tdeux ) )) }) ;
  21. draw node[anchor=#3] (#4) at #5 {$z =#2$};
  22. draw[fleche] (C2) -- (#4.west) ;
  23. }
  24.  
  25. tikzset{ fleche/.style={<-,>=latex,line width=0.2mm,shorten <=-0.02cm} }
  26.  
  27. begin{document}
  28.  
  29. begin{tikzpicture}
  30.  
  31. defK{2}
  32. defw{(3.14159*2)}
  33. defTtrace{3}
  34.  
  35. begin{axis}[axis x line=bottom, axis y line = left, width=13cm, height=axisdefaultheight,ymax=1.55*K,
  36. ytick=empty,extra y ticks={K}, extra y tick labels={},extra y tick style={grid=major}
  37. ]
  38.  
  39. addplot[samples=2,domain=0:(Ttrace+0.1),thick=1pt] { K };
  40.  
  41. addploZ{2}{blue}
  42. addploZ{4}{red}
  43.  
  44. LegendArrows{4}{0.6}{west}{C3}{($(C2)+(axis cs:1,-0.5)$)}
  45. LegendArrows{2}{0.6}{south}{C4}{(C3.north)}
  46.  
  47. end{axis}
  48. end{tikzpicture}
  49.  
  50.  
  51. end{document}
  52.  
  53. begin{document}
  54. begin{tikzpicture}
  55.  
  56. defK{2}
  57. defw{(3.14159*2)}
  58. defTtrace{3}
  59.  
  60. begin{axis}[axis x line=bottom, axis y line = left, width=13cm, height=axisdefaultheight,ymax=1.55*K,
  61. ytick=empty,extra y ticks={K}, extra y tick labels={},extra y tick style={grid=major}
  62. ]
  63.  
  64. addplot[samples=2,domain=0:(Ttrace+0.1),thick=1pt] { K };
  65.  
  66. addploZ{2}{blue}
  67. addploZ{4}{red}
  68.  
  69. newcommand*{addploZ}[2]{
  70. addplot[#2,samples=60,domain=0:Ttrace,thick=3pt,ultra thick,
  71. evaluate={ Tun = (1 / ( 6 *(#1-sqrt(#1^2 -1)) ));
  72. Tdeux = (1 / ( 6 *(#1+sqrt(#1^2 -1)) )); }
  73. ] { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-x/ Tun ) - Tdeux *exp(-x/ Tdeux ) )) };
  74. }
  75.  
  76. LegendArrows{4}{0.6}{west}{C3}{($(C2)+(axis cs:1,-0.5)$)}
  77. LegendArrows{2}{0.6}{south}{C4}{(C3.north)}
  78.  
  79. newcommand*{LegendArrows}[5]{
  80. pgfmathparse{(1 / ( 6 *(#1-sqrt(#1^2 -1)) ))} pgfmathresult letTunpgfmathresult
  81. pgfmathparse{(1 / ( 6 *(#1+sqrt(#1^2 -1)) ))} pgfmathresult letTdeuxpgfmathresult
  82. coordinate (C2) at (axis cs:#2, { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-#2/ Tun )
  83. - Tdeux *exp(-#2/ Tdeux ) )) }) ;
  84. draw node[anchor=#3] (#4) at #5 {$z =#2$};
  85. draw[fleche] (C2) -- (#4.west) ;
  86. }
  87.  
  88. newcommand*{LegendArrows}[5]{
  89. coordinate[evaluate={ Tun = (1 / ( 6 *(#1-sqrt(#1^2 -1)) ));
  90. Tdeux = (1 / ( 6 *(#1+sqrt(#1^2 -1)) )); }
  91. ] (C2) at (axis cs:#2, { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-#2/ Tun ) - Tdeux *exp(-#2/ Tdeux ) )) }) ;
  92. draw node[anchor=#3] (#4) at #5 {$z =#2$};
  93. draw[fleche] (C2) -- (#4.west) ;
  94. }
  95.  
  96. newcommand*{LegendArrows}[5]{
  97. node[evaluate={ Tun = (1 / ( 6 *(#1-sqrt(#1^2 -1)) ));
  98. Tdeux = (1 / ( 6 *(#1+sqrt(#1^2 -1)) )); }
  99. ] (C2) at (axis cs:#2, { K * (1 - ( 1/( Tun - Tdeux ) )*( Tun *exp(-#2/ Tun ) - Tdeux *exp(-#2/ Tdeux ) )) }) {} ;
  100. draw node[anchor=#3] (#4) at #5 {$z =#2$};
  101. draw[fleche] (C2) -- (#4.west) ;
  102. }
  103.  
  104. end{axis}
  105. end{tikzpicture}
  106. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement