在 tikz 中绘制带弹簧的机械系统

在 tikz 中绘制带弹簧的机械系统

我需要帮助在 Latex 中绘制以下系统以供论文使用。我不是 tikz 专家,所以目前这超出了我的能力范围。系统示意图 任何帮助我都感激不尽。

这是我在以下建议的帮助下取得的成果

    \documentclass[10pt]{article}  

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

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=4em,minimum height=1em]

\node[draw, minimum width=12em,minimum height=1em, inner sep=0] (S1) at (0,0){cap};
\path (S1.south west) -- (S1.south east) coordinate[pos=0.05](p1) coordinate[pos=0.9](p2)coordinate[pos=0.5](c1);

% left leg
\node[draw, minimum width=1em,minimum height=8em,  yshift=0em, xshift=-0.05em, inner sep=0,below=-0.05em of p1 ] (S2){};
% ground at left leg
\node (ground1) at (S1.south) [ground,yshift=-8em,xshift=-5.5em,anchor=north] {};
\draw (ground1.north west) -- (ground1.north east);

% right leg
\node[draw, minimum width=1em,minimum height=8em, yshift=0em,xshift=0.7em, inner sep=0,below=-0.05em of p2 ] (S3){};
% ground at left leg
\node (ground2) at (S1.south) [ground,yshift=-8em,xshift=5.5em,anchor=north] {};
\draw (ground2.north west) -- (ground2.north east);

\node[draw, minimum width=1em,minimum height=12em, inner sep=0,below=0em of c1 ] (S4){L};

\node[draw, minimum width=1em,minimum height=12em, inner sep=0,below=0em of c1, rotate around={10:(c1)},dashed] (S4){$ \theta $};

 \draw[-latex, thick] (0.70,-4.25) -- node[above] {$\large\mathsf{F_w}$} +(1.5,0);

\end{tikzpicture}
%%%%%%%%%%%%%%%
\vspace{2cm}

\begin{tikzpicture}
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=4em,minimum height=1em]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]

\node[draw, minimum width=12em,minimum height=1em, dashed, inner sep=0] (S1) at (0,0){cap};
\path (S1.south west) -- (S1.south east) coordinate[pos=0.05](p1) coordinate[pos=0.9](p2)
coordinate[pos=0.5](c1);

\node[draw, minimum width=12em,minimum height=1em,  inner sep=0] (S1b) at (1em,0){ };
\path (S1b.south west) -- (S1b.south east) coordinate[pos=0.05](p1b) coordinate[pos=0.9](p2b)
coordinate[pos=0.5](c1b);

\path (S1.south west) -- (S1.south east) 
coordinate[pos=0.05](p3) coordinate[pos=0.9](p4) coordinate[pos=0.5](c2);

% left leg
%\node[draw, minimum width=1em,minimum height=8em,  yshift=0em, xshift=-0.05em, inner sep=0,below=-0.05em of p1 ] (S2){};
% ground at left leg
\node (ground1) at (S1.south) [ground,yshift=-8em,xshift=-5.5em,anchor=north] {};
\draw (ground1.north west) -- (ground1.north east);
\draw [spring](ground1.north) -- ($(S1b.south east)!(ground1.north)!(S1b.south west)$);

% right leg
%\node[draw, minimum width=1em,minimum height=8em, yshift=0em,xshift=0.7em, inner sep=0,below=-0.05em of p2 ] (S3){};
% ground at left leg
\node (ground2) at (S1.south) [ground, yshift=-8em,xshift=5.5em, anchor=north] {};
\draw (ground2.north west) -- (ground2.north east);
\draw [spring](ground2.north) -- ($(S1b.south east)!(ground2.north)!(S1b.south west)$);


\node[draw, minimum width=1em,minimum height=12em, dashed, inner sep=0,below=0em of c1 ] (S4){};

\node[draw, minimum width=1em,minimum height=12em, yshift=0.35em,xshift=2.0em, inner sep=0,below=0em of c1, rotate around={-10:(c2)}] (S4){$ \theta $};

\draw[-latex, thick] (2,0) -- node[above] {$\large\mathsf{F_x}$} +(1.5,0);
\draw[-latex, thick] (0,0.15) -- node[right] {$\large\mathsf{F_y}$} +(0,1.0);

\end{tikzpicture}
%%%%%%%%%%%%%%%

\vspace{2cm}
%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=4em,minimum height=1em]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]

\node[draw, minimum width=12em,minimum height=1em, inner sep=0] (S1) at (0,0){cap};
path (S1.south west) -- (S1.south east) coordinate[pos=0.1](p1)
 coordinate[pos=0.9](p2)coordinate[pos=0.5](c1);


% left leg
\node[draw, minimum width=1em,minimum height=8em,  yshift=0em, xshift=-0.05em, inner sep=0,below=-0.05em of p1 ] (S2){};
% ground at left leg
\node (ground1) at (S1.south) [ground,yshift=-8em,xshift=-5.5em,anchor=north] {};
\draw (ground1.north west) -- (ground1.north east);

% right leg
\node[draw, minimum width=1em,minimum height=8em, yshift=0em,xshift=0.7em, inner sep=0,below=-0.05em of p2 ] (S3){};
% ground at left leg
\node (ground2) at (S1.south) [ground,yshift=-8em,xshift=5.5em,anchor=north] {};
\draw (ground2.north west) -- (ground2.north east);


%\node[ minimum width=1em,minimum height=8em, inner sep=0, below=0em of c1 ] (S4){};
\draw [spring](c1) -- ($(S1.south east)!(c1)!(S1.south west)$);
%\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of c1, rotate around={15:(c1)}] (S4b){};

%\draw[decoration={zigzag,amplitude=1em},decorate] (S4.north) -- (S4.south);
%\draw[decoration={zigzag,amplitude=1em},decorate] (S4b.north) -- (S4b.south);

%\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of S4.south,draw ] (S5){};
%\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of S4b.south, draw ] (S5){};

\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

具体问题

  1. 如何增加弹簧的倾斜度?
  2. 如何完成图 3?

答案1

前两个图表的提议,第三个应该很容易

\documentclass[10pt]{article}  

\usepackage{tikz}
\usetikzlibrary{calc,decorations}
\usetikzlibrary{positioning}

\usepackage{pgfplots}


\begin{document}

\begin{tikzpicture}
\node[draw, minimum width=12em,minimum height=1em, inner sep=0] (S1) at (0,0){};
\path (S1.south west) -- (S1.south east) coordinate[pos=0.1](p1) coordinate[pos=0.9](p2)coordinate[pos=0.5](c1);
\node[draw, minimum width=1em,minimum height=8em, inner sep=0,below=0em of p1 ] (S2){};
\node[draw, minimum width=1em,minimum height=8em, inner sep=0,below=0em of p2 ] (S3){};

\node[draw, minimum width=1em,minimum height=12em, inner sep=0,below=0em of c1 ] (S4){};
\node[draw, minimum width=1em,minimum height=12em, inner sep=0,below=0em of c1, rotate around={10:(c1)},dashed] (S4){};

\end{tikzpicture}
\begin{tikzpicture}
\node[draw, minimum width=12em,minimum height=1em, inner sep=0] (S1) at (0,0){};
\path (S1.south west) -- (S1.south east) coordinate[pos=0.1](p1) coordinate[pos=0.9](p2)coordinate[pos=0.5](c1);
\node[draw, minimum width=1em,minimum height=8em, inner sep=0,below=0em of p1 ] (S2){};
\node[draw, minimum width=1em,minimum height=8em, inner sep=0,below=0em of p2 ] (S3){};

\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of c1 ] (S4){};
\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of c1, rotate around={15:(c1)}] (S4b){};

\draw[decoration={zigzag,amplitude=1em},decorate] (S4.north) -- (S4.south);
\draw[decoration={zigzag,amplitude=1em},decorate] (S4b.north) -- (S4b.south);

\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of S4.south,draw ] (S5){};
\node[ minimum width=1em,minimum height=8em, inner sep=0,below=0em of S4b.south, draw ] (S5){};

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

\documentclass[tikz,border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
    \begin{tikzpicture}
        \pgfmathsetmacro{\angle}{7};
        \draw (0,0) rectangle (1,5);
        \draw (-1,0) -- (2,0);
        \draw (10,0) rectangle (11,5);
        \draw (9,0) -- (12,0);
        \draw (0,5) rectangle (11,6);
        \draw (-2,-2) .. controls (-1,-2) and (0,-1) .. (3,-1) .. controls (10,-1) and (10.5,-2) .. (13,-2);

        \draw[dashed] (5.75,5) rectangle (5.25,-5);
        \draw[-latex, ultra thick] (3.5,-4) -- node[above] {\Large\sffamily$\mathsf{Fw}$} +(1.5,0);
        \draw (5.75,5) -- (5.25,5) -- ++({270+\angle}:10) -- node[below] {$\mathsf{theta}$} ++(\angle:0.5) -- cycle;
        \node[font=\Huge\sffamily] at (3,3) {$\mathsf{L}$};
    \end{tikzpicture}

    \begin{tikzpicture}
        \draw (0,0) rectangle (1,5);
        \draw (-1,0) -- (2,0);
        \draw (10,0) rectangle (11,5);
        \draw (9,0) -- (12,0);
        \draw (0,5) rectangle (11,6);
        \draw (-2,-2) .. controls (-1,-2) and (0,-1) .. (3,-1) .. controls (10,-1) and (10.5,-2) .. (13,-2);

        \draw (5.75,-.5) rectangle (5.25,-7);
        \draw[dashed] (7.25,-.5) rectangle (6.75,-7);
        \draw[decorate, decoration={zigzag,amplitude=6pt}] (5.5,5) -- (5.5,-.5);
        \draw[decorate, decoration={zigzag,amplitude=6pt}, dashed] (5.5,5) -- (7,-.5);
        \draw[-latex, ultra thick] (3,-5) node[above] {\Large\sffamily$\mathsf{Fx}$} -- +(1.5,0);
        \draw[-latex, ultra thick] (4.5,2) -- +(0,1.5);
        \node[font=\Huge\sffamily] at (4.5,-6) {$\mathsf{L}$};
    \end{tikzpicture}

    \begin{tikzpicture}
        \draw[decorate, decoration={zigzag,amplitude=10pt,segment length=30pt}] (0,5) -- node[midway, xshift=-30pt, font=\sffamily] {$\mathsf{k}$} (0.5,0);
        \draw (-1,0) -- (2,0);
        \draw[decorate, decoration={zigzag,amplitude=10pt,segment length=30pt}] (10,5) -- node[midway, xshift=30pt, font=\sffamily] {$\mathsf{k}$} (10.5,0);
        \draw (9,0) -- (12,0);
        \draw (0,5) rectangle (11,6);
        \draw (-2,-2) .. controls (-1,-2) and (0,-1) .. (3,-1) .. controls (10,-1) and (10.5,-2) .. (13,-2);

        \draw[dashed] (5.75,5) rectangle (5.25,-5);
        \draw (6.75,5) node[below right] {$\mathsf{theta}$} -- (5.75,-5) -- (5.25,-5) -- (6.25,5);
        \draw[-latex, ultra thick] (4.5,-3) -- (4.65,-1.5);
        \draw[-latex, ultra thick] (4,6.9) node[left] {$\mathsf{Fx}$} -- +(1.5,0);
        \draw[-latex, ultra thick] (4,7) -- +(0,1.5) node[left] {$\mathsf{Fy}$};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容