Für den unten angegebenen Code erhalte ich die folgende Fehlermeldung:
Mathematisch-Fehler im Paket PGF: Unbekannter Operator c' or
co‘ (in ‚{4cos(deg(x))}‘).
Mathefehler im Paket PGF: Unbekannter Operator p' or
„pi“ (in „2pi“).
Mathefehler im Paket PGF: Unbekannter Operator p' or
„pi“ (in „2pi“).
Bitte helfen Sie
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{amsmath}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{graphicx} % Required for inserting images
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.8]
\draw[<->] (-4,0) -- (4,0) node[right] {$x$};
\draw[<->] (0,-4) -- (0,4) node[above] {$y$};
\draw[dashed] (0,-4) -- (0,4);
\draw[blue,thick,->] plot [domain=0:2pi,samples=100] ({0},{4cos(deg(x))});
\draw[red,thick,->] plot [domain=0:2pi,samples=100] ({0},{-4cos(deg(x))});
\end{tikzpicture}
\end{center}
\end{document}
Antwort1
Versuche dies:
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{amsmath}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{graphicx} % Required for inserting images
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=0.8]
\draw[<->] (-4,0) -- (4,0) node[right] {$x$};
\draw[<->] (0,-4) -- (0,4) node[above] {$y$};
\draw[dashed] (0,-4) -- (0,4);
\draw[blue,thick,domain=0:{2*pi},samples=100] plot ({\x},{4*cos(\x r)});
\draw[red,thick,domain=0:{2*pi},samples=100] plot ({\x},{-4*cos(\x r)});
\end{tikzpicture}
\end{center}
\end{document}