Kurveninterpolation

Kurveninterpolation

Ich versuche, diese Kurven zu interpolieren und das Ergebnis ist nicht sehr schön: Bildbeschreibung hier eingeben

Was ich versucht habe:

\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}

Das Ergebnis :

Bildbeschreibung hier eingeben

Wie glätte ich diese Kurven, damit sie realistischer aussehen? Und ich möchte auch die eingekreisten Zahlen hinzufügen

Antwort1

So geht's:

  • Entfernen von unnötigem Code aus Ihrem Beispiel
  • Ersetzen --durchto[out=,in=]
  • Setzen eines Zwischenpunktes für die blaue Kurve
  • Anbringen von Beschriftungen am Ende jeder Kurve mit einigen Varianten zum Verschieben

Sie können auch controlseinen anderen Ansatz über Bézierkurven verwenden. Ich finde, dass sich die Effekte von toleichter visualisieren lassen.

Ich schlage vor, Ihre Grafiken in separaten Dateien mit Klasse zu zeichnen standaloneUND die PDFs über das Paket einzubinden graphicx. Siehe hier fürein Beispiel, obwohl ich vorgeschlagen habe, dies zu tunmehrmals (mehr erfahren).

Ergebnis

%\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}

verwandte Informationen