Tikz: Feder-Masse-System

Tabellen und Grafiken erstellen und anordnen


kannstmasehn
Forum-Century
Forum-Century
Beiträge: 165
Registriert: Mo 5. Mai 2014, 16:55

Tikz: Feder-Masse-System

Beitrag von kannstmasehn »

Moin,

folgendes möchte ich ändern bzw. ergänzen, nur bekomme es nicht hin. Hier mein Minimalbeispiel:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}

\begin{document}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
\tikzstyle{damper}=[thick,decoration={markings,  
  mark connection node=dmp,
  mark=at position 0.5 with 
  {
    \node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum height=3pt,draw=none] {};
    \draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
    \draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
  }
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]



\node (M) [minimum width=1cm, minimum height=1cm,yshift=-6cm] {$m$};

\begin{scope}[rotate=-180,transform shape]   

\node (wall) [ground, minimum width=1cm,yshift=0cm] {};
\draw (wall.north east) -- (wall.north west);

\draw [line width=0.8pt] (wall.north) -- ++(0,001cm)coordinate (z);
\draw [spring] (z) -- ++(0,2cm)coordinate (t); 
\draw [spring] (t) -- ++(0,2cm)coordinate (u); 
\draw [line width=0.8pt] (u) -- (M.north);
\draw [-latex,ultra thick] (M.south) ++ (0cm,0) -- +(0cm,1);
\end{scope}

\end{tikzpicture}
\end{document}
Zu ändern/ ergänzen:

1) Benennung der Federn
2) Abstand der oberen Feder zum Grund verringern, wenn ich das System mit nur einer Feder aufbaue, dann ist die Feder näher dran.

Wie kann ich das umsetzen?

Danke schonmal!

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Re: Tikz: Feder-Masse-System

Beitrag von esdd »

kannstmasehn hat geschrieben:
\draw [line width=0.8pt] (wall.north) -- ++(0,001cm)coordinate (z);
2) Abstand der oberen Feder zum Grund verringern, wenn ich das System mit nur einer Feder aufbaue, dann ist die Feder näher dran.
In dem Du den vertikalen Abstand von wall.north bis z kürzer als einen 1cm machst?? (0,001cm) bedeutet 0 in x-Richtung und 001cm=1cm in y-Richtung.

Die Federn kannst Du wie jeden anderen Pfad beschriften. Allerdings stellst Du in der scope alle Nodes auf den Kopf und Du lässt in der gesamten Zeichnung alle Nodes zeichnen. Das trifft dann beides auch auf die Beschriftungen zu ;-)

Gruß
Elke

kannstmasehn
Forum-Century
Forum-Century
Beiträge: 165
Registriert: Mo 5. Mai 2014, 16:55

Beitrag von kannstmasehn »

Gut, danke. Habe das nochmal umgearbeitet. Da war ja viel Müll drin.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}

\begin{document}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]

\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.7cm,minimum height=0.3cm]

\node (M) [minimum width=1cm, minimum height=1cm,yshift=-2.65cm] {$m$};
\node (wall) [ground, minimum width=1cm,yshift=0cm] {};
\draw (wall.south east) -- (wall.south west);
\node [draw=none] at (1,-1)  {$s_{W}$};
\draw [spring] (wall.south) -- ++(0,-2cm)coordinate (M.north); 
\draw [-latex,ultra thick] (M.south) ++ (0cm,0) -- +(0cm,-1);

\begin{scope}[xshift=3cm]  
\node (M) [minimum width=1cm, minimum height=1cm,yshift=-4.65cm] {$m$};
\node (wall) [ground, minimum width=1cm,yshift=0cm] {};
\draw (wall.south east) -- (wall.south west);
\node [draw=none] at (1,-1)  {$s_{W}$};
\node [draw=none] at (1,-3)  {$s_{L}$};
\draw [spring] (wall.south) -- ++(0,-2cm)coordinate (t); 
\draw [spring] (t) -- ++(0,-2cm)coordinate (M.north); 
\draw [-latex,ultra thick] (M.south) ++ (0cm,0) -- +(0cm,-1);
\end{scope}

\end{tikzpicture}
\end{document}
Noch eine Frage: Den node (M) muss ich um -4,65cm bzw. -2,65 in y verschieben. Ich habe als pre und als post für einen spring ja 0,3cm angegeben. Woher kommen die 0,5cm? Wegen der Höhe des Buchstabens 'm'?

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Das ist schon besser.

ground wird mit seinem Zentrum im Ursprung positioniert. Sein south Anker liefert deshalb -0.3cm/2=-0.15cm. Die Feder ist einschließlich pre und post 2cm lang. Da die Masse 1cm hoch ist, muss ihr Zentrum dann bei -.15cm-2cm-1cm/2=-2.65cm liegen. Bei zwei Federn muss eine weitere Federlänge abgezogen werden. Aber Du musst die Position der Massenode nicht berechnen. Füge sie einfach nach der letzten Feder ein ;-)
\documentclass{article} 
\usepackage{tikz} 
\usetikzlibrary{
  patterns,
  decorations.pathmorphing
} 
\begin{document} 
\begin{tikzpicture}
  \def\springlength{2}
  \tikzset{
      box/.style={draw,outer sep=0pt,thick},
      spring/.style={thick,decorate,
        decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}},
      springdescr/.style={xshift=.5cm},
      ground/.style={box,draw=none,fill,
        pattern=north east lines,minimum width=1cm,minimum height=0.3cm},
      mass/.style={box,minimum width=1cm,minimum height=1cm},
      direction/.style={-latex,ultra thick}
    }
  %\draw[step=5mm,help lines](-.5,-6.15)grid(4,.15);
  \node (wall) [ground] {}; 
  \draw (wall.south east) -- (wall.south west); 
  \draw [spring] (wall.south) -- node[springdescr]{$s_{W}$} 
        +(0,-\springlength)node[mass,anchor=north](M){$m$}; 
  \draw [direction] (M.south) -- +(0,{-.5*\springlength}); 
  \begin{scope}[xshift=3cm]
    \node (wall) [ground] {}; 
    \draw (wall.south east) -- (wall.south west); 
    \draw [spring] (wall.south) -- node[springdescr]{$s_{W}$}
          +(0,-\springlength)coordinate(t);
    \draw [spring](t)-- node[springdescr]{$s_{L}$}
          +(0,-\springlength)node[mass,anchor=north](M){$m$}; 
    \draw [direction] (M.south) -- +(0,{-.5*\springlength});
  \end{scope} 
\end{tikzpicture} 
\end{document} 
Gruß
Elke

Bild
Dateianhänge
gl_federn.png
gl_federn.png (8.15 KiB) 2165 mal betrachtet

kannstmasehn
Forum-Century
Forum-Century
Beiträge: 165
Registriert: Mo 5. Mai 2014, 16:55

Beitrag von kannstmasehn »

Das schaut ja noch besser aus! Ist natürlich auch logisch im nachhinein. Vielen herzlichen Dank.

Ein schönes Wochenende wünsche ich!

Antworten