帶圓弧的函數

帶圓弧的函數

我正在嘗試重新創建這個圖形。

在此輸入影像描述

我知道我的方法是過時的並且有些錯誤,我問是否有更好的方法來複製上述內容,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 提供的語法kZ. 橢圓弧的原因是你的函數似乎在 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,以控制弧線。讀取最大值等很簡單,您可以使用 TikZ 用它來做各種事情,如圖所示。

相關內容