Skip to content

Instantly share code, notes, and snippets.

@EduardoJM
Created October 23, 2019 19:41
Show Gist options
  • Save EduardoJM/8c3f137f251a3e8333248bf396f65788 to your computer and use it in GitHub Desktop.
Save EduardoJM/8c3f137f251a3e8333248bf396f65788 to your computer and use it in GitHub Desktop.
Código LaTeX usando pacotes tikz plotando gráfico com funções admissiveis
%
% Código LaTeX usando pacotes tikz plotando gráfico com funções admissiveis
% Por Eduardo Oliveira (https://eduardojm.github.io)
%
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin=-1, xmax=6, ymin=-1, ymax=6]
% draw axis without ticks
\tkzDrawX[noticks]
\tkzDrawY[noticks]
% define extrems on y(x) curve
\tkzDefPoint[](2.5, 2.0){A}
\tkzDefPoint[](4.6, 3.76){B}
% define helper points
\tkzDefPoint[](2.5, 0.0){C}
\tkzDefPoint[](4.6, 0.0){D}
\tkzDefPoint[](0.0, 2.0){E}
\tkzDefPoint[](0.0, 3.76){F}
% helper points to put labels
\tkzDefPoint[](3.4, 3.2){G}
\tkzDefPoint[](2.6, 1.7){H}
\tkzDefPoint[](3.7, 4.2){I}
\tkzDefPoint[](3.2, 0.4){J}
% draw extrem points on y(x) curve
\tkzDrawPoint[fill=black, size=7](A)
\tkzDrawPoint[fill=black, size=7](B)
% y(x)
\tkzFct[domain=2.5:4.6]{-exp(-x+3.2)+4}
% eta(x)
\tkzFct[domain=2.5:4.6]{-0.18*x*x+1.29*x-2.09}
% y(x) + 2*eta(x)
\tkzFct[domain=2.5:4.6,dashed]{-exp(-x+3.2)+4+2*(-0.18*x*x+1.29*x-2.09)}
% y(x) - 4*eta(x)
\tkzFct[domain=2.5:4.6,dashed]{-exp(-x+3.2)+4-4*(-0.18*x*x+1.29*x-2.09)}
% draw dotted segments (x_1, y_1), (x_2, y_2)
\tkzDrawSegment[dotted](A,C)
\tkzDrawSegment[dotted](B,D)
\tkzDrawSegment[dotted](A,E)
\tkzDrawSegment[dotted](B,F)
% x_1, x_2, y_1, y_2 labels
\tkzLabelPoint[below](C){$x_1$}
\tkzLabelPoint[below](D){$x_2$}
\tkzLabelPoint[left](E){$y_1$}
\tkzLabelPoint[left](F){$y_2$}
\tkzLabelPoint[right](G){$y(x)$}
\tkzLabelPoint[right](H){$Y_2(x)=y(x)+\varepsilon _2 \eta(x)$}
\tkzLabelPoint[right](I){$Y_1(x)=y(x)+\varepsilon _1 \eta(x)$}
\tkzLabelPoint[right](J){$\eta(x)$}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment