
저는 GeoGebra를 사용하여 정규 분포 플롯을 생성한 다음 이를 PGF/TikZ로 내보내려고 했습니다. 다음 LaTex 코드를 얻었습니다. 그런데 TexStudio에 붙여넣고 컴파일하면 오류 메시지가 나타납니다 line 19: Dimension too large \end{frame}
. 어떻게 해야 하나요? 감사합니다!
\documentclass[10pt]{beamer}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{frame}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=black] (-4,0) -- (4,0);
\foreach \x in {-4,-3,-2,-1,1,2,3}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\draw[->,color=black] (0,-0.01) -- (0,0.46);
\foreach \y in {,0.2,0.3,0.4}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\clip(-4,-0.01) rectangle (4,0.46);
\onslide<2->{
\draw[smooth,samples=100,domain=-4.0:4.0] plot(\x,{2.718281828^((-((\x))^2)/(1^2*2))/(abs(1)*sqrt(3.1415926535*2))});
}
\end{tikzpicture}
\end{frame}
\end{document}
답변1
주요 오류는 이어야 하는 지수 연산자의 2.718281828^에서 발생합니다 exp()
. 두 번째 오류는 clip
명령이 환경에 국한되어야 한다는 것입니다 scope
. 정규 분포는 매우 작기 때문에 yscale=4
더 잘 볼 수 있도록 확대하기 위해 범위에서 사용됩니다.
\documentclass[10pt]{beamer}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{frame}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
\begin{scope}[yscale=4]
\draw[->,color=black] (-4,0) -- (4,0);
\foreach \x in {-4,-3,-2,-1,1,2,3}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt);
\draw[->,color=black] (0,-0.01) -- (0,0.46);
\foreach \y in {0,0.1,0.2,0.3,0.4}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\clip(-4,-0.01) rectangle (4,0.46);
\onslide<2>{
%\draw[smooth,samples=100,domain=-4.0:4.0] plot(\x,{2.718281828^((-((\x))^2)/(1^2*2))/(abs(1)*sqrt(3.1415926535*2))}); <---- error in this line
\draw[smooth,samples=100,domain=-4.0:4.0]
plot(\x,{exp((-((\x))^2)/(1^2*2))/(abs(1)*sqrt(3.1415926535*2))});
%\draw[smooth,samples=100,domain=-4.0:4.0] plot(\x,{exp((-(\x)^2)/(2*1^2))/(abs(1)*sqrt(pi*2))}); <---- change 3.1415.... int0 pi
}
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}