水平多路振荡器

水平多路振荡器

很抱歉出现上述问题,我是这个论坛的新手。

我编写了以下代码,以便绘制 2 个带阻尼器的耦合水平振荡器:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{calc,patterns,decorations.markings}
\usetikzlibrary{positioning}

\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=10pt,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,-3pt)$) -- ($(dmp.north)+(0,3pt)$);
  }
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.3cm]

\begin{scope}[xshift=7cm]
\node (M) [minimum width=1cm, minimum height=1cm] {$m$} node[draw=none,fill=none,pos=.5,below] {1};

\draw [<-,thick](-2.6,.6) -- (-1.5,-.2);

\node (wall) [ground, rotate=-90, minimum width=2cm,yshift=-3cm] {};

\draw (wall.north east) -- (wall.north west);

\draw [spring] (wall.120) -- ($(M.north west)!(wall.120)!(M.south west)$) node[draw=none,fill=none,pos=.5,above] {$k_1$};

\draw [damper] (wall.20) -- ($(M.north west)!(wall.20)!(M.south west)$) node[draw=none,fill=none,pos=.5,below] {$d_1$};
\end{scope}

\begin{scope}[xshift=10cm]
\node (M1) [minimum width=1cm, minimum height=1cm] {$m$} node[draw=none,fill=none,pos=.5,below] {2};

\draw [spring] (M.10) -- ($(M1.north west)!(M.10)!(M1.south west)$) node[draw=none,fill=none,pos=.5,above] {$K$};

\draw [damper] (M.-40) -- ($(M1.north west)!(M.-40)!(M1.south west)$);

\draw [->,thick](1.4,-.2) -- (2.5,.6);
\end{scope}

\begin{scope}[xshift=10cm]
\node (wall1) [ground, rotate=90, minimum width=2cm,yshift=-3cm] {};

\draw (wall1.north west) -- (wall1.north east);

\draw [spring] (wall1.60) -- ($(M1.north east)!(wall1.60)!(M1.south east)$) node[draw=none,fill=none,pos=.5,above] {$k_2$};

\draw [damper] (wall1.-160) -- ($(M1.north east)!(wall1.-160)!(M1.south east)$) node[draw=none,fill=none,pos=.5,below] {$d_2$};
\end{scope}

\end{tikzpicture}

\end{document}

在此处输入图片描述

我需要帮助来解决以下问题:

  1. 两个减震器的标注“d_1”和“d_2”应位于减震器下方约 3 毫米处。
  2. 两个块的标记“1”和“2”应该放在矩形下方,而不是内部。
  3. 第二个阻尼器的右侧点应从右侧墙壁的垂直规则开始,而不是从那些东北线开始。

答案1

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}

\begin{tikzpicture}[
  wall/.style = {gray,fill=gray},
  mass/.style = {draw,circle,ball color=red},
  spring/.style = {decorate,decoration={zigzag, pre length=.3cm,post length=.3cm,segment length=#1}},
  ]
  \draw[wall] (-.5,-1) rectangle (0,1);
  \coordinate (l) at (0,0);
  \node[mass,label={above:$m_1$}] (m1) at (3,0) {};
  \node[mass,label={above:$m_2$}] (m2) at (5,0) {};
  \coordinate (r) at (6,0);
  \draw[wall] (6,-1) rectangle (6.5,1);

  \draw[spring=8pt] (l) -- node[above] {$k_1$} (m1);
  \draw[spring=4pt] (m1) -- node[above] {$K$} (m2);
  \draw[spring=2pt] (m2) -- node[above] {$k_2$} (r);
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容