我希望它与左侧舱口相同,并将 c1 阻尼器和 k1 弹簧连接到左壁。我已经尝试使用此代码
\documentclass[letterpaper,11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{float}
\usepackage[none]{hyphenat}
\usepackage{array}
\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{width=15cm,compat=1.9}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,fit,matrix}
\usepackage{scalerel}
\let\savestar\star
\renewcommand\star{{\scalerel*{\bigstar}{\savestar}}}%Para escalar los símbolos
\usepackage[resetlabels,labeled]{multibib}
\begin{document}
\begin{tikzpicture}
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.2cm,post length=0.2cm,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] {}; % Minimum width es el ancho de los amortiguadores,minimum height es la separación en el amortiguador
\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) [draw,outer sep=0pt,thick,minimum width=1cm, minimum height=2cm] {$m_1$};
\node (M2) [draw,outer sep=0pt,thick,minimum width=1cm, minimum height=2cm] at (2,0) {$m_2$};
\node (ground) [ground,anchor=north,yshift=-0.25cm,minimum width=5.5cm,xshift=1cm] at (M.south) {};
\draw (ground.north west) -- (ground.north east) -- (ground.south east) -- (ground.south west);
\node (fill) [ground,xshift=-0.15cm,minimum height = 0.3cm, minimum width = 0.3cm] at (ground.west) {};
\node (fill2) [xshift=-0.15cm,minimum height = 0.3cm, minimum width = 0.3cm] at (ground.east) {};
\draw (fill.north west) -- (fill.south west) -- (fill.south east);
\draw [thick] (M.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\draw [thick] (M2.south west) ++ (0.2cm,-0.125cm) circle (0.125cm) (M2.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);
\node (wall) [ground, rotate=-90, minimum width=2.5cm,anchor=south east] at (fill.north west) {};
\draw (wall.north east) -- (wall.north west) -- (wall.south west) -- (wall.south east);
\node (wall2) [rotate=-90, minimum width=2.5cm,anchor=south east] at (fill2.north west) {};
\draw (wall2.north east) -- (wall2.north west) -- (wall2.south west) -- (wall2.south east);
%\draw [spring] (M.220) -- ($(M.north east)!(wall.-4)!(wall.south west)$);
\draw [spring] (M.220) -- (-1.5,-0.45);
\draw [spring] (M2.220) -- ($(M.north east)!(M.220)!(M.south east)$);
\draw [spring] (3.5,-0.45) -- (2.5,-0.45);
\draw [damper] (M.170) -- (-1.5,0.1);
\draw [damper] (M2.170) -- ($(M.north east)!(M2.170)!(M.south east)$);
\draw [damper] (3.5,0.1) -- (2.5,0.1);
\node at (-1,.8) {$c_1$};
\node at (1,.8) {$c_2$};
\node at (3,.8) {$c_3$};
\node at (-1,-.8) {$k_1$};
\node at (1,-.8) {$k_2$};
\node at (3,-.8) {$k_3$};
\end{tikzpicture}
\end{document}
知道如何解决这个问题吗?
答案1
这会在墙上添加图案并简化一些事情。还有进一步的改进空间,但quotes
此处的使用可能不是其中之一。
\documentclass[letterpaper,11pt]{report}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.markings,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[spring/.style={thick,decorate,decoration={zigzag,pre length=0.2cm,post
length=0.2cm,segment length=6}},
damper/.style={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] {}; % Minimum width es el ancho de los amortiguadores,minimum height es la separación en el amortiguador
\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}]]
\begin{scope}[local bounding box=One-should-not-use-tikzstyle]
\node (M) [draw,outer sep=0pt,thick,minimum width=1cm, minimum height=2cm] {$m_1$};
\node (M2) [draw,outer sep=0pt,thick,minimum width=1cm, minimum height=2cm] at (2,0) {$m_2$};
\draw [thick] (M.south west) ++ (0.2cm,-0.125cm) circle[radius=0.125cm] (M.south east) ++ (-0.2cm,-0.125cm) circle[radius=0.125cm];
\draw [thick] (M2.south west) ++ (0.2cm,-0.125cm) circle[radius=0.125cm] (M2.south east) ++ (-0.2cm,-0.125cm) circle[radius=0.125cm];
\draw [spring] (M.220) -- node[below=0.2ex]{$k_1$} ++ (-1,0);
\draw [spring] (M2.220) -- node[below=0.2ex]{$k_2$} ($(M.north east)!(M.220)!(M.south east)$);
\draw [spring] (M2.-40) -- node[below=0.2ex]{$k_3$} ++ (1,0);
\draw [damper] (M.170) -- node[above=1em]{$c_1$} ++ (-1,0);
\draw [damper] (M2.170) -- node[above=1em]{$c_2$}($(M.north east)!(M2.170)!(M.south east)$);
\draw [damper] (M2.10) -- node[above=1em]{$c_3$} ++ (1,0);
\end{scope}
\draw[pattern=north east lines,thick] ([xshift=-5mm]One-should-not-use-tikzstyle.north west)
-| (One-should-not-use-tikzstyle.south west) -|
(One-should-not-use-tikzstyle.north east) -|
([xshift=5mm,yshift=-5mm]One-should-not-use-tikzstyle.south east) -| cycle;
\end{tikzpicture}
\end{document}