Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{graphicx} % to add figure environment that comes with caption
- usepackage{caption} %if you don't want to float your figure for using captionof
- usepackage{tikz}
- usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,circuits}
- begin{document}
- Using verb|graphicx| package:
- begin{figure}[htbp]
- centering
- 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{dampener}=[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=4cm,minimum height=0.3cm]
- begin{scope}
- node at (0,0) [draw,rectangle, minimum width=2cm,minimum height=1cm,anchor=south,,transform shape](m1) {$m1$};
- draw [very thick, -latex](m1.north) -- +(0,1);
- node at (0,-2) [rectangle, minimum width=2cm,minimum height=1cm,anchor=north,,transform shape](m2) {$m2$};
- draw [very thick, -latex](m2.north) -- +(0,1);
- draw [spring] (-0.5,-2) -- (-0.5,0) node[midway,left=0.3cm] {k1};
- draw [dampener,label=D1,] (0.5,-2) -- (0.5,0)node[midway,right=0.4cm] {d1};
- node (ground1) at (0,-5) [ground, anchor=north] {};
- % draw [ground] (-1,-5) -- (1,-5);
- draw [spring] (-0.5,-5) -- (-0.5,-3)node[midway,left=0.3cm] {k2};
- % draw [spring] (-0.5,-5) -- (-0.5,-3)node[draw=none,midway,left=0.3cm] {k2}; % If you don't want borders around lables use [draw=none]
- draw [dampener] (0.5,-5) -- (0.5,-3)node[midway,right=0.4cm] {d2};
- end{scope}
- end{tikzpicture}
- caption{My figure}label{fig:myfigure1}
- end{figure}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement