\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[>=latex]
\draw[gray,very thin] (0,-2) grid (8,2);
\draw[thick] (0,0) sin (1,2) cos (2,0) sin (3,-2) cos (4,0) sin (5,2) cos (6,0) sin (7,-2) cos (8,0);
\draw[<->,xshift=-2mm](0,-2)--++(90:1) node[midway,left]{$1.0$ cm};
\draw (current bounding box.south)
node[below=2mm]{c.r.o. screen};
\draw[<->,yshift=-2mm](0,-2)--++(0:1)
node[midway,below]{$1.0$ cm};
\end{tikzpicture}
\end{document}
\documentclass[pstricks,border=25pt]{standalone}
\usepackage{pst-coil,graphicx,pst-plot}
\begin{document}
\begin{pspicture}(8,4)
\psgrid[subgriddiv=0,gridlabels=0]
\pssin[periods=2cm](0,2)(8,2)
\def\Fig{\pcline[arrowinset=0]{<->}(0,0)(1,0)}
\rput(0,-.15){\Fig \nbput{\small 1.0 cm}}
\rput(-.15,0){\rotatebox{90}{\Fig \naput{\small 1.0 cm}}}
\end{pspicture}
\end{document}
问题:
在 PSTricks 中,相当于
\draw[thick] (0,0) sin (1,2) cos (2,0) sin (3,-2) cos (4,0) sin (5,2) cos (6,0) sin (7,-2) cos (8,0);
? 并帮我将其完成为 TikZ 的结果?
答案1
我不明白你的问题,因为绘制正弦曲线非常简单:
\documentclass[pstricks,border=25pt]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(-0.5,0)(8,4)
\psgrid[subgriddiv=0,gridlabels=0]
\psplot[algebraic]{0}{8}{2*sin(x*1.57)+2}
\pcline[arrowinset=0,offset=-0.2]{<->}(0,0)(1,0)\nbput{\small 1.0 cm}
\pcline[arrowinset=0,offset=-0.2]{<->}(0,1)(0,0)\nbput{\small 1.0 cm}
\end{pspicture}
\end{document}