2018년 9월 5일 수요일

Tikz 02 : 조금 더 복잡한 그래프 그리기

적분 내용을 정리할께 있어서 그려봤습니다. 설명이나 주석은 따로 달지 않겠습니다.

\documentclass[]{article}

%opening
\usepackage{tikz}

\begin{document}
\pagenumbering{gobble}
\begin{figure}
 
 \begin{tikzpicture}[scale=1]
 
 \draw [thick,->] (-1,0) --  (8,0) node [anchor=north] {$x$};
 \draw [thick,->] (0,-1)  -- (0,6) node [anchor=east] {$y$};
 
 \draw[dashed] (0.5,0)-- (0.5,5.2375) ;

 \draw[fill=red, dashed] (2.5,0) -- (3.5,0) -- (3.5,3.3875) -- (2.5,3.3875) -- cycle;

 \draw[dashed] (5.5,0) --(5.5,2.8625);
 
 \draw[dashed] (0.5,0) -- (0.5,-0.2) node[below]{$a$};
 \draw[dashed] (2.5,0) -- (2.5,-0.2) node[below]{$x$};
 \draw[dashed] (3.5,0) -- (3.5,-0.2) node[below]{$x+dx$};
 \draw[dashed] (5.5,0) -- (5.5,-0.2) node[below]{$b$};
 
    \draw [<->] (2.2,0)  -- (2.2,1.7) node [left] {$f(x_t)$}  -- (2.2,3.3875) ;
 \draw [<->] (2.5,1)  -- (3,1) node [below] {$dx$}  -- (3.5,1) ;
 
 \draw[domain=-0.5:6.5, smooth,thick,,variable=\x, blue] plot ({\x},{0.1*(\x+1)*(\x-2)*(\x-6)+4}) node[left]{$y=f(x)$};
 
 \node [below] at (-0.3,0) {$0$};
 
 \end{tikzpicture}
 
\end{figure}

\end{document}


\documentclass[]{article}

%opening
\usepackage{tikz}

\begin{document}
\pagenumbering{gobble}
\begin{figure}
 
 \begin{tikzpicture}[scale=1]
 
 \draw [thick,->] (-1,0) --  (8,0) node [anchor=north] {$x$};
 \draw [thick,->] (0,-1)  -- (0,6) node [anchor=east] {$y$};
 
 \draw[dashed] (0.5,0) -- (1,0) -- (1,5.25) -- (0.5,5.25) -- cycle;
 \draw[dashed] (1,0) -- (1.5,0) -- (1.5,5) -- (1,5) -- cycle;
 \draw[dashed] (1.5,0) -- (2,0) -- (2,4.5625) -- (1.5,4.5625);
 \draw[dashed] (2,0) -- (2.5,0) -- (2.5,4) -- (2,4);
 \draw[fill=red, dashed] (2.5,0) -- (3,0) -- (3,3.3875) -- (2.5,3.3875);
 \draw[dashed] (3,3.3875) -- (3.2,3.3875 );
 \draw[dashed] (5.0,0) -- (5.5,0) -- (5.5,2.2225) -- (5.0,2.2225) -- cycle;
 \draw[dashed] (5.5,2.2225) -- (5.5, 2.8625);
 
 \draw[dashed] (0.5,0) -- (0.5,-0.2) node[below]{$a$};
 \draw[dashed] (5.5,0) -- (5.5,-0.2) node[below]{$b$};
 
 \draw[dashed] (1,0) -- (1,-0.2) node[below]{$x_1$};
 \draw[dashed] (1.5,0) -- (1.5,-0.2) node[below]{$x_2$};
 \draw[dashed] (2,0) -- (2,-0.2) node[below]{$x_3$};
 \draw[dashed] (2.5,0) -- (2.5,-0.2) node[below]{$x_4$};
 \draw[dashed] (3,0) -- (3,-0.2) node[below]{$x_5$};
 
 \draw[dashed] (5.0,0) -- (5.0,-0.2) node[below]{$x_{n-1}$};

    \draw [<->] (3.3,0)  -- (3.3,1.7) node [right] {$f(x_k)$}  -- (3.3,3.3875) ;
 \draw [<->] (2.5,1)  -- (2.7,1) node [below] {$\Delta x$}  -- (3,1) ;
 
 \draw[domain=-0.5:6.5, smooth,thick,,variable=\x, blue] plot ({\x},{0.1*(\x+1)*(\x-2)*(\x-6)+4}) node[left]{$y=f(x)$};
 
 \node [below] at (-0.3,0) {$0$};
 \node [below] at (0.5,-0.58) {$=x_0$};
 
 \node [below] at (4,-0.2) {$...$};
 \node [below] at (4,1) {$...$};
 
 \end{tikzpicture}
 
\end{figure}

\end{document}




댓글 없음:

댓글 쓰기