我想用 TikZ 制作一幅物理图片。你能帮助我吗?

我想用 TikZ 制作一幅物理图片。你能帮助我吗?

在此处输入图片描述

类似的例子:

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
  \begin{tikzpicture}[
    force/.style={>=latex,draw=blue,fill=blue},
    axis/.style={densely dashed,gray,font=\small},
    M/.style={rectangle,draw,fill=lightgray,minimum size=0.5cm,thin},
    m/.style={rectangle,draw=black,fill=gray,minimum size=0.3cm,thin},
    plane/.style={draw=black,fill=blue!10},
    string/.style={draw=red, thick},
    pulley/.style={draw, thick, circle},
    ]
    %mainshape

    \filldraw[blue!30!white, draw=black] (0,0) coordinate (b) rectangle (3,1) coordinate (c);
%   \draw[pulley] (3.1,1.2) circle (0.25cm);
    \node (pulley) [pulley, minimum width=.5cm, anchor=south west] at (c) {};
    \filldraw[gray!40!white, draw=black] (1.5,1.05) rectangle (2,1.55);
    \draw[red,thick] (2,1.2)--(pulley.west);
    \filldraw[gray, draw=black] (3.10, 0.1) rectangle (3.6, 0.6) coordinate (a);
    \draw[red,thick] (a -| pulley.south)--(pulley.south);

%FBD1

\begin{scope};
  \node[M, right=50pt of a](M){};
  {[axis,->]
    \draw (0,-1) -- (0,2) node[right] {$+y$};
    \draw (M) -- ++(2,0) node[right] {$+x$};}
  {[force,->]
    % Assuming that Mg = 1. The normal force will therefore be cos(alpha)
    \draw (M.center) -- ++(0,1) node[above right] {$F_N$};
    \draw (M.west) -- ++(-1,0) node[left] {$F_f$};
    \draw (M.east) -- ++(1,0) node[above] {$T$};}
  \draw[force,->] (M.center)-- ++(0,-1) node[below] {$Mg$};
\end{scope};

%FBD2
\node[m, left=25pt of b] (m) {};
\draw[axis,->] (m) -- ++(0,-2) node[left] {$+$};
{[force,->]
  \draw (m.north) -- ++(0,1) node[above] {$T'$};
  \draw (m.south) -- ++(0,-1) node[right] {$mg$};
};

  \end{tikzpicture}
\end{document}

答案1

其实这些图片不需要花太多时间。你展示一些代码很好,但那些代码似乎不相关。

\documentclass[tikz]{standalone}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[dashed,very thin] (0,-1) grid (7.5,1);
\draw[->] (0,-2)--(0,2) node[left] {$x\;(\si{\centi\metre})$};
\draw[->] (-1,0)--(8.5,0) node[below] {$t\;(\SI{-e2}{\second})$};
\draw plot[smooth,samples=500,domain=0:7] (\x,{cos(deg(pi*\x/2))});
\foreach \i in {5,10,...,35} \draw (\i/5,0) node[below] {$\i$};
\draw (0,0) node[below left] {$0$} (0,-1) node[left] {$-10$} (0,1) node[left] {$10$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[<->] (0,-3) node[left] {$y$} -- (0,-2) node[left] {$O_y$} -- (0,0) node[above left] {$O$} -- (2,0) node[above] {$O_x$} -- (3,0) node[above] {$x$};
\fill (0,-2) circle (1pt) (0,0) circle (1pt) (2,0) circle (1pt);
\end{tikzpicture}
\end{document}

在此处输入图片描述

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw[fill=yellow] (0,0) rectangle (4.5,-.2);
\draw (3,0.03) rectangle (4,.5);
\draw (0,0) -- (-.25,.25);
\fill (-.25,.25) circle (1pt);
\draw (-.75,-2.5) rectangle (.25,-2.97);
\draw[decoration={aspect=0.3,segment length=1.5mm, amplitude=2mm,coil},decorate] (0,.25) -- (3,.25);
\draw[decoration={aspect=0.3,segment length=1.5mm, amplitude=2mm,coil},decorate] (-.25,0) -- (-.25,-2.5);
\draw (-.25,0)|-(0,.25);
\draw (3.5,0.5) node[above] {$A$} (-.75,-2.75) node[left] {$B$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

JouleV 和 Zarko 在附近,如果你幸运的话,他们会拍摄另外两张照片。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
 \node[draw,label=left:$B$,minimum width=2em,minimum height=1em] (B){};
 \node[draw,label=above:$A$,minimum width=2em,minimum height=1.5em] (A) at (2,2){};
 \node[circle,fill,inner sep=1.5pt] (C) at (B|-A){};
 \draw[decorate,decoration={coil,segment length=3pt}] (B)  -- (C)  -- (A);
 \draw[fill=gray] ([xshift=1em,yshift=-\pgflinewidth]A.south east) rectangle ++
 (-2.4,-0.2);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容