我正在尝试一些相当新的东西。虽然这可能需要时间,但如果有人能帮忙我会很高兴。我试图修改现有的图形,但他们无法创建我想要的东西。
我的 MWE 是:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
\begin{document}
\begin{tikzpicture}[M1/.style={rectangle,draw=black,minimum size=2cm,thick}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=5}]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]
\node [M1] (M1) {};
\node (wall1) [ground, minimum width=3.5cm,yshift=-3cm] {};
\draw [spring] (wall1.170) -- ($(M1.south east)!(wall1.170)!(M1.south west)$) node[pos=.5,left] {$k_1$};
\draw [spring] (wall1.25) -- ($(M1.south west)!(wall1.25)!(M1.south east)$) node[pos=.5,right] {$k_2$};
\node at (0,-3.5) {(a)};
\end{tikzpicture}
\end{document}
答案1
我不希望收到您的任何回复,因为这个问题太老了,但这是新人提出的建议circuitikz
:
\documentclass[margin=3pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (-3,0) rectangle (3,2.5) node[midway] {$M$};
\draw (-2,0) to[R=$k_b$] (-2,-6);
\draw (1,0) to[R=$k_1$] (1,-2);
\draw (1,-2) -- (2,-2) to[R=$k_2$] (2,-5) -| (1,-6);
\draw (1,-5) -- (0,-5) to[damper=$\eta$] (0,-2) -- (1,-2);
\draw (-3.5,-6) rectangle (3.5,-6.5);
\draw[-latex] (3,1.25) -- ++ (2.5,0) -- ++ (0,2) node[above] {$x_2$};
\draw[-latex] (3.5,-6.25) -- ++ (2,0) -- ++ (0,2) node[above] {$x_1$};
\end{circuitikz}
\end{document}