曲线插值

曲线插值

我尝试插入这些曲线,但得到的结果不太好: 在此处输入图片描述

我尝试过:

\documentclass[french,25pt,a4paper,landscape]{article}
\usepackage{etex}

\usepackage{tikz}
\usepackage[T1]{fontenc}
\usepackage{xcolor}



\begin{document}
    \begin{center}
        \definecolor{qqwuqq}{rgb}{0,0.39215686274509803,0}
            \definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
            \definecolor{qqqqff}{rgb}{0,0,1}
            \begin{tikzpicture}[line cap=round,line join=round,>=stealth,x=1cm,y=1cm]
            \coordinate[label=below:$O$] (A) at (0,0);
            \coordinate[label=below left:] (B) at (0,4);
            \coordinate[label=below left:$t$] (C) at (4,0);
            
            \coordinate[label=above right:] (D) at (0.54,1.04);
            \coordinate[label=above right:] (E) at (1.38,1.58);
            \coordinate[label=above right:] (F) at (1.9,1.667);
            \coordinate[label=above right:] (G) at (2.76,1.767);
            \coordinate[label=above right:] (H) at (4.36,1.8);

            \coordinate[label=above right:] (I) at (0.3,3.82);
            \coordinate[label=above right:] (J) at (0.5,3.5);
            \coordinate[label=above right:] (K) at (0.7,2.94);
            \coordinate[label=above right:] (L) at (0.84,2.44);
            \coordinate[label=above right:] (M) at (1,2);
            \coordinate[label=above right:] (N) at (1.24,1.36);
            \coordinate[label=above right:] (O) at (1.86,0.86);
            \coordinate[label=above right:] (P) at (2.44,0.54);
            \coordinate[label=above right:] (Q) at (2.86,0.22);
            \coordinate[label=above right:] (R) at (3.42,0.18);

            \coordinate[label=above right:] (S) at (0.84,0.38);
            \coordinate[label=above right:] (T) at (1.61,1.04);
            \coordinate[label=above right:] (U) at (1.92,1.68);
            \coordinate[label=above right:] (V) at (2.52,3.04);
            \coordinate[label=above right:] (W) at (2.84,4.32);
            

            
            \draw [->,line width=0.8pt] (A) -- (B) node[midway, below left] {};
            \draw [->,line width=0.8pt] (A) -- (C) node[midway, above] {};

            \draw [red] plot [smooth, tension=0.6] coordinates { (A) (D) (E) (F) (G) (H)};
            \draw [blue, dashed] plot [smooth, tension=0.6] coordinates { (I) (J) (K) (L) (M) (N) (O) (P) (Q) (R)};

            \draw [green] plot [smooth, tension=0.6] coordinates { (A) (S) (T) (U) (V) (W)};
            
            \fill (A) circle (2pt);
            \fill (B) circle (0pt);
            \fill (C) circle (0pt);
            \end{tikzpicture}
    \end{center}
\end{document}

结果 :

在此处输入图片描述

我该如何平滑这些曲线,让它们看起来更真实?我还想添加带圆圈的数字

答案1

这是实现此目的的方法。按键:

  • 从示例中删除不必要的代码
  • 替换--to[out=,in=]
  • 为蓝色曲线设置一个中间点
  • 在每条曲线的末端贴上标签,并附上一些变化来移动它

您还可以使用controls另一种方法,即贝塞尔曲线。我发现效果to更容易可视化。

我建议使用类在单独的文件中绘制图形standalone并通过包包含所述pdf graphicx。请参阅此处一个例子,而我建议这样做多次(查找更多)

结果

%\documentclass[french,25pt,a4paper,landscape]{article}
%\usepackage{etex}
%
%\usepackage{tikz}
%\usepackage[T1]{fontenc}
%\usepackage{xcolor}

\documentclass[10pt,border=3mm,tikz]{standalone}

\begin{document}
%    \begin{center}

% ~~~ you don't use them here ... ~~~~~~~~~~~~~~~~~~~~~
%        \definecolor{qqwuqq}{rgb}{0,0.39215686274509803,0}
%        \definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666}
%        \definecolor{qqqqff}{rgb}{0,0,1}
        
        
 \begin{tikzpicture}[
    line cap=round,
    line join=round,
    >=stealth,
    lbl/.style={draw,circle},
%   x=1cm,y=1cm
    ]
            \coordinate[label=below:$O$] (A) at (0,0);
            \coordinate[label=below left:] (B) at (0,4);
            \coordinate[label=below left:$t$] (C) at (4,0);
%            
%            \coordinate[label=above right:] (D) at (0.54,1.04);
%            \coordinate[label=above right:] (E) at (1.38,1.58);
%            \coordinate[label=above right:] (F) at (1.9,1.667);
%            \coordinate[label=above right:] (G) at (2.76,1.767);
            \coordinate[label=above right:] (H) at (4.36,1.8);
%
            \coordinate[label=above right:] (I) at (0.3,3.82);
%            \coordinate[label=above right:] (J) at (0.5,3.5);
%            \coordinate[label=above right:] (K) at (0.7,2.94);
%            \coordinate[label=above right:] (L) at (0.84,2.44);
%            \coordinate[label=above right:] (M) at (1,2);
%            \coordinate[label=above right:] (N) at (1.24,1.36);
%            \coordinate[label=above right:] (O) at (1.86,0.86);
%            \coordinate[label=above right:] (P) at (2.44,0.54);
%            \coordinate[label=above right:] (Q) at (2.86,0.22);
            \coordinate[label=above right:] (R) at (3.42,0.18);
%
%            \coordinate[label=above right:] (S) at (0.84,0.38);
%            \coordinate[label=above right:] (T) at (1.61,1.04);
%            \coordinate[label=above right:] (U) at (1.92,1.68);
%            \coordinate[label=above right:] (V) at (2.52,3.04);
            \coordinate[label=above right:] (W) at (2.84,4.32);
            

    % ~~~ y- and x-axis ~~~~~~~~~~~~~~~~~~~~~~~~~
    \draw [->,line width=0.8pt] (A) -- (B) node[midway, below left] {?};
    \draw [->,line width=0.8pt] (A) -- (C) node[midway, above] {??};

    % ~~~ curves ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    %\draw[red] (A) -- (H); % start like this
    \draw[red]      (A) to[out=60,in=182] (H) node[lbl,yshift=4mm] {3}; % refined
    \draw[teal!80]  (A) to[out=20,in=250] (W) node[lbl,shift=(200:7mm)] {1};
    \draw[blue,dashed]
                    (I) to[out=-35,in=110] +(.7,-1.6) 
                        to[out=290,in=180] (R) node[lbl,shift=(120:7mm)] {2};
    
    %\draw [red] plot [smooth, tension=0.6] coordinates { (A) (D) (E) (F) (G) (H)};
    %\draw [blue, dashed] plot [smooth, tension=0.6] coordinates { (I) (J) (K) (L) (M) (N) (O) (P) (Q) (R)};

    %\draw [green] plot [smooth, tension=0.6] coordinates { (A) (S) (T) (U) (V) (W)};
            
    \fill (A) circle (2pt);
    \fill (B) circle (0pt);
    \fill (C) circle (0pt);
 \end{tikzpicture}
%    \end{center}
\end{document}

相关内容