Funktionen zeichnen

Formelsatz für Mathematik, Naturwissenschaften und Technik


Eduard
Forum-Guru
Forum-Guru
Beiträge: 348
Registriert: Sa 2. Mai 2015, 22:02

Funktionen zeichnen

Beitrag von Eduard »

Hallo zusammen,

ich würde gerne die angehängt Funktion zeichnen. Leider kenne ich mich tikzpicture gar nicht aus. Habe folgendes gefunden, weiß aber nicht, wie ich das Ganze so verändern kann, damit meine gewünschte Funktion rauskommt.
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[
    scale=5,
    axis/.style={very thick, ->, >=stealth'},
    important line/.style={thick},
    dashed line/.style={dashed, thin},
    pile/.style={thick, ->, >=stealth', shorten <=2pt, shorten
    >=2pt},
    every node/.style={color=black}
    ]
    % axis
    \draw[axis] (-0.1,0)  -- (1.1,0) node(xline)[right]
        {$x_2$};
    \draw[axis] (0,-0.1) -- (0,1.1) node(yline)[above] {$x_1$};
    % Lines
    \draw[important line] (.15,.15) coordinate (A) -- (.85,.85)
        coordinate (B) node[right, text width=5em] {$Y^O$};
    \draw[important line] (.0,.85) coordinate (C) -- (.85,.15)
        coordinate (D) node[right, text width=7em] {$\mathit{NX}=x$};
    % Intersection of lines
    \fill[red] (intersection cs:
       first line={(A) -- (B)},
       second line={(C) -- (D)}) coordinate (E) circle (.4pt)
       node[above,] {$A$};
    % The E point is placed more or less randomly
    \fill[red]  (E) +(-.075cm,-.2cm) coordinate (out) circle (.4pt)
        node[below left] {$B$};
    % Line connecting out and ext balances
    \draw [pile] (out) -- (intersection of A--B and out--[shift={(0:1pt)}]out)
        coordinate (extbal);
    \fill[red] (extbal) circle (.4pt) node[above] {$C$};
    % line connecting  out and int balances
    \draw [pile] (out) -- (intersection of C--D and out--[shift={(0:1pt)}]out)
        coordinate (intbal);
    \fill[red] (intbal) circle (.4pt) node[above] {$D$};
    % line between out og all balanced out :)
    \draw[pile] (out) -- (E);
\end{tikzpicture}
\end{document}
Wäre super, falls mir jemand kurz sagen könnte, wie ich das hinbekommen. Vielen Dank!
Dateianhänge
GL1.jpeg
GL1.jpeg (28.1 KiB) 5675 mal betrachtet

markusv
Forum-Meister
Forum-Meister
Beiträge: 947
Registriert: Do 3. Sep 2015, 17:20
Wohnort: Leipzig

Beitrag von markusv »

Hallo.

Eine Möglichkeit, welche sich aber sicherlich noch eleganter gestalten lässt:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{mathtools}
\begin{document}
\begin{tikzpicture}[scale=3]
    % axis
    \draw[thin,-latex] (0,0)  -- (1.5,0) node(xline)[below] {$x_1$};
    \draw[thin,-latex] (0,0) -- (0,1.5) node(yline)[left] {$x_2$};
    % Lines
    \draw[] (0,1) node[left] {$\dfrac{y}{p_2}$} -- (1,0) node[below] {$\dfrac{y}{p_1}$};
    \draw[dashed] (0,.5) node[left] {$x_2^*$} -| (.5,0) node[below] {$x_1^*$};
    \draw[fill] (.5,.5) circle (.5pt) node[xshift=.75cm] {$-\dfrac{p_1}{p_2}$};
    \draw (0.5,0.5) arc(45:90:-1);
    \draw (0.5,0.5) arc(45:0:-1);
\end{tikzpicture}
\end{document}
Wäre Microsoft Word für das Schreiben von Büchern entwickelt worden,
würde es Microsoft Book heißen.

Unkomplizierte und schnelle LaTeX-Hilfe, bspw. Erstellung von Vorlagen und Bewerbungen:
Help-LaTeX@web.de

Eduard
Forum-Guru
Forum-Guru
Beiträge: 348
Registriert: Sa 2. Mai 2015, 22:02

Beitrag von Eduard »

Super! Das sieht perfekt aus! Gibt es irgendwo eine Anleitung (Schritt für Schritt) wie man solche Sachen zeichnen kann? Ich verstehe nämlich noch nicht ganz wie das funktioniert, um selbst so etwas zusammenzustellen.

Stamm-

Aus erster Hand

Beitrag von Stamm- »

Eduard hat geschrieben:[…] Gibt es irgendwo eine Anleitung (Schritt für Schritt) wie man solche Sachen zeichnen kann? Ich verstehe nämlich noch nicht ganz wie das funktioniert, um selbst so etwas zusammenzustellen.
Klar. Die Anleitung zu »PGF/TikZ« (1302 Seiten). Teil I davon ist für Anfänger sicher ganz besonders interessant. Kommandozeile öffnen und hiermit die Anleitung mit »texdoc« abrufen.
  • texdoc pgf

Eduard
Forum-Guru
Forum-Guru
Beiträge: 348
Registriert: Sa 2. Mai 2015, 22:02

Beitrag von Eduard »

ich habe jetzt versucht eine fallende Gerade zu zeichnen:
\begin{tikzpicture} 
\hspace*{1cm}
\draw [->] (0,0) -- (4,0) node[right] {$\textcolor{brown}{\pmb{x_1}}$};
\draw [->] (0,0) -- (0,4) node[above] {$\textcolor{magenta}{\pmb{x_2}}$;

%\draw[orange, domain=0:4]  plot (\x, {-x+3.5});
\draw [orange, very thick] (0,3.5) -- (3.5,0);

\end{tikzpicture}
Mit der Funktion draw geht das. Aber mit Plot nicht. Wie genau müsste ich so eine Funktion eingeben? Also Beispiel: y=3.5x

Die meisten Beispiele verwenden eine e-Funktion oder sin oder cos.

Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Beitrag von Bartman »

\documentclass[tikz]{standalone}
\newcommand{\pmb}{}% unbekannter Befehl

\begin{document}
\begin{tikzpicture}
\draw [->] (0,0) -- (4,0) node[right, text=brown] {$\pmb{x_1}$};
\draw [->] (0,0) -- (0,4) node[above, text=magenta] {$\pmb{x_2}$};% Der mathematische Modus endet bei Dir an der falschen Stelle.

\draw[orange, domain=0:4]  plot (\x, {-\x+3.5});% Beim zweiten x fehlt der Backslash.
\draw [orange, very thick] (0,3.5) -- (3.5,0);
\end{tikzpicture}
\end{document}

Eduard
Forum-Guru
Forum-Guru
Beiträge: 348
Registriert: Sa 2. Mai 2015, 22:02

Beitrag von Eduard »

Perfekt! In der Zwischenzeit habe ich schon das Manual angefangen zu lesen. Langsam wird einiges klar, aber insgesamt wirkt es trotzdem noch hoch komplex. Vielen Dank für deine Hilfe!

Stamm-

Detailfrage

Beitrag von Stamm- »

\documentclass[parskip=half]{scrartcl}
\usepackage[T1]{fontenc}

\PassOptionsToPackage{svgnames}{xcolor}
\usepackage{tikz}
\usepackage{bm}

\usepackage{lmodern}
\usepackage{microtype}

\begin{document}
  \begin{tikzpicture}[domain=0:4]
    \draw [->] (0,0) -- (4,0) node[right] {$\textcolor{brown}{\bm{x_1}}$};
    \draw [->] (0,0) -- (0,4) node[above] {$\textcolor{magenta}{\bm{x_2}}$};
    \draw[orange] plot (\x,{-\x+3.5});
  \end{tikzpicture}
\end{document}

Antworten