使用 pgf 图绘制图形不正确,图形似乎因随机噪声而反转

使用 pgf 图绘制图形不正确,图形似乎因随机噪声而反转

以下是问题的简短版本(向下滚动一点)

我正在尝试在这里制作这个图形(底部的手绘部分应该是错误出现的图形) 在此处输入图片描述

曲线方程的形式如下(左上角的方程): 在此处输入图片描述

因此我编写的代码如下:

\documentclass[english]{article}
\usepackage[T1]{fontenc}

\makeatletter
\usepackage{tikz}
\usepackage{pgfplots}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw (0,0) rectangle (8,8);
\begin{scope}[scale=1]
\clip  (0,0) rectangle (8,8);
\draw [domain=-10:-170,samples=200] plot ({3+1*cos(\x)}, {6+1*sin(\x)}); 
\draw [domain=0:-220,samples=200] plot ({3+2*cos(\x)}, {6+2*sin(\x)}); 
\draw [domain=0:-250,samples=200] plot ({3+3*cos(\x)}, {6+3*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({3+4*cos(\x)}, {6+4*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({3+5*cos(\x)}, {6+5*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({3+6*cos(\x)}, {6+6*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({3+7*cos(\x)}, {6+7*sin(\x)}); 
\draw [domain=-10:-170,samples=200] plot ({5+1*cos(\x)}, {6+1*sin(\x)}); 
\draw [domain=40:-180,samples=200] plot ({5+2*cos(\x)}, {6+2*sin(\x)}); 
\draw [domain=0:360,samples=200] plot ({5+3*cos(\x)}, {6+3*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({5+4*cos(\x)}, {6+4*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({5+5*cos(\x)}, {6+5*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({5+6*cos(\x)}, {6+6*sin(\x)}); 
\draw [domain=0:-360,samples=200] plot ({5+7*cos(\x)}, {6+7*sin(\x)}); 
\draw [densely dashed,thick] (4,6.4) +(-61.7:0.65) -- +(-61.7:8);
\draw [densely dashed,thick] (4,6.4) +(-118.3:0.65) -- +(-118.3:8);
\draw [densely dashed,thick] (4,5.8) -- (4,0);
\end{scope}
\fill[white] (2,6) rectangle (6,8);
\draw (2,6) rectangle (6,8);
\draw (3,6.2) circle (0.1);
\draw (5,6.2) circle (0.1);
\begin{scope}[yshift=-6cm]
\begin{axis}[
hide axis,
trig format=rad,
,
]
\addplot [
    black,
domain={-0.73}:{0.73},
    samples=201,
]
    {2*(3*pi*sin(sin(\x))^(2)*(3*pi*sin(\x))^(-2)};
\end{axis}
\end{scope}
\end{tikzpicture}
\end{document}

然而它在这里产生了这个图像: 在此处输入图片描述

我目前不知道为什么它看起来不像第二张图里的图形。

如果读起来太长,这就是问题所在,以下代码:

\documentclass[english]{article}
\usepackage[T1]{fontenc}

\makeatletter
\usepackage{pgfplots}
\usepackage{tikz}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
trig format=rad,
,
]
\addplot [
    black,
domain={-0.73}:{0.73},
    samples=500,
]
    {2*(3*pi*sin(sin(\x))^(2)*(3*pi*sin(\x))^(-2)};
\end{axis}
\end{tikzpicture}
\end{document}

呈现此功能: 在此处输入图片描述 没有这个功能 在此处输入图片描述

答案1

我认为这是你应用方式的问题BODMAS:)

我希望下面正确的脚本能有所帮助。

\documentclass[english]{article}
\usepackage[T1]{fontenc}

\makeatletter
\usepackage{pgfplots}
\usepackage{tikz}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
trig format=rad,
,
]
\addplot [
    black,
domain={-0.73}:{0.73},
    samples=500,
]
    {2*(sin(3*pi*sin(\x))^(2)*(3*pi*sin(\x))^(-2)};
\end{axis}
\end{tikzpicture}
\end{document}

给出:

在此处输入图片描述

相关内容