带弧的函数

带弧的函数

我正在尝试重新创建该图形。

在此处输入图片描述

我知道我的方法是过时的并且有些错误,我想问是否有更好的方法来复制上面表示的内容function而不必像我目前正在做的那样进行半手动绘制curve through points

说明:

该函数没有公式定义,但它表示信号幅度与模数转换器输出的噪声基底(具有恒定幅度的噪声)之间的距离。随着信号幅度的增加,它与噪声的距离呈线性增加。因此这是函数的第一部分。但随后它的增长不再是线性的,然后达到峰值,随后模数转换器饱和,信号幅度与噪声基底之间的距离急剧减小。

以下是我对此 MWE 的尝试:

\documentclass{memoir}
\usepackage{tikz,pgfplots}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes,snakes}
\usetikzlibrary{patterns,hobby}

\begin{document}
\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}
        \draw[-{Latex[length=2.5mm, width=1.5mm]}] (0,0)--(6,0) node[anchor=north]{};
        \draw[-{Latex[length=2.5mm, width=1.5mm]}] (0,0)--(0,6) node[anchor=east]{};
        \node[anchor=south, rotate=90] at (-0.5,3) {$SNR,~SNDR~[dB]$};
        \node[anchor=north] at (3,-0.5) {$Input~Signal~Amplitude~[dBv]$};
        \node[anchor=north east] at (0,0) {0};

        \draw (0,0) -- (4,4);
        \draw (4,4) to [curve through ={(4.2,4) . . (4.5,3.6)}] (5,2);% curve
    \end{tikzpicture}
    \caption{Performance metrics.}
\end{figure}
\end{document}

结果:

在此处输入图片描述

答案1

您可以直接绘制函数。如果您提供更多有关此图来源的背景信息,我会找到更好的函数。我在这里做的是绘制椭圆弧。我为此使用了函数,但您也可以直接使用arcTi 提供的语法Z. 使用椭圆弧的原因是您的函数似乎在 x_max/2 处变为垂直。绘制函数的原因是我怀疑您在这些图背后有一个理论,并最终会用真实函数来填充图。(我假设您在绘制其他特征时不会遇到困难。)

\documentclass{memoir}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,intersections}

\begin{document}
I guess that has now become more a mathematics problem. Let's assume you really
want a function that starts off at $(x_1,y_1)$ somewhere with slope 1 and then
has slope $-\infty$ at some other place. This defines an elliptical arc, which
can be parametrized by
\[ \gamma(\varphi)~=~\left(\begin{array}{c}
 x_0+a\,\cos(\varphi)\\ b\,\sin(\varphi)
\end{array}\right)\;.\]
Here, we have set a possible shift in $y$ direction to 0 since we want the slope
to become infinite when the curve hits the $x$--axis.
What is the angle at which the slope is 1? The slope is given by the ratio of
the derivatives of the coordinates, such that
\[ -\frac{b\,\cos(\varphi_1)}{a\,\sin(\varphi_1)}~\stackrel{!}{=}~1
\quad\curvearrowright\quad \varphi_1~=~-\arctan\left(\frac{b}{a}\right)\;.
\]
Now we want at the same time that
\[ \gamma(\varphi)~=~\left(\begin{array}{c}
 x_0+a\,\cos(\varphi_1)\\ b\,\sin(\varphi_1)
\end{array}\right)~=~
\left(\begin{array}{c}
x_0-\frac{1}{\sqrt{1+b^2/a^2}}\\
\frac{b/a}{\sqrt{1+b^2/a^2}}
\end{array}\right)
~\stackrel{!}{=}~
\left(\begin{array}{c}x_1\\ y_1\end{array}\right)\;.\]
This means that we can only adjust one parameter, say $b$, and the other
parameters are then fixed by
\[
 a^2~=~\frac{b}{y_1}\,\sqrt{b^2-y_1^2}\quad\text{and}\quad
 x_0~=~x_1-y_1+\frac{b^2}{y_1}\;.
\]
\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}
        \draw[-{Latex[length=2.5mm, width=1.5mm]}] (0,0)--(6,0) node[anchor=north]{};
        \draw[-{Latex[length=2.5mm, width=1.5mm]}] (0,0)--(0,6) node[anchor=east]{};
        \node[anchor=south, rotate=90] at (-0.5,3) {SNR,~SNDR~[dB]};
        \node[anchor=north] at (3,-0.5) {Input~Signal~Amplitude~[dBv]};
        \node[anchor=north east] at (0,0) {0};

        \draw (0,0) -- (4,4);
        % in these examples I have set x_1 = y_1 = 4
        \def\xOne{4}
        \def\b{4.15}
        \pgfmathsetmacro{\a}{\b*sqrt((\b^2-\xOne^2))/4}
        \draw[name path=upper plot] plot[variable=\x,domain=180-atan(\b/\a):0,samples=50] 
        ({\xOne-(\xOne-\b^2/\xOne)+\a*cos(\x)},{\b*sin(\x)});
        \coordinate (max1) at({\xOne-(\xOne-\b^2/\xOne)+\a*cos(90)},{\b*sin(90)});
        \def\b{3.9}
        \def\xOne{3.7}
        \pgfmathsetmacro{\a}{\b*sqrt((\b^2-\xOne^2))/\xOne}
        \draw[dashed,name path=lower plot] plot[variable=\x,domain=180-atan(\b/\a):0,samples=50] 
        ({\xOne-(\xOne-\b^2/\xOne)+\a*cos(\x)},{\b*sin(\x)});
        \coordinate (max2) at
        ({\xOne-(\xOne-\b^2/\xOne)+\a*cos(90)},{\b*sin(90)});
        \coordinate (O) at (0,0);
        \draw[dotted] (O|-max1) -- (max1) node[above,pos=0.7]{SNR$_\mathrm{peak}$} --(O-|max1);
        \path [name path=horizontal 2] (max2) -- ++(2cm,0);
        \draw [dotted,name intersections={of=upper plot and horizontal 2, by={a0}}]
         (a0) -- ++(-2cm,0) node[left]{SNDR$_\mathrm{peak}$};
    \end{tikzpicture}
    \caption{Performance metrics.}
\end{figure}
\end{document}

在此处输入图片描述 你可以调整一个参数 \b,以便控制弧线。而且,读取最大值等也很简单,你可以使用 TiZ 可以做各种事情,如图所示。

相关内容