Thanks.
Main doc
--------
Code: Select all
\documentclass[12pt,fleqn,reqno]{article}
\usepackage{amsfonts,graphics,epsfig,cite}
\usepackage{amsmath,graphicx,amssymb,amsthm}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage[margin=1.5in]{geometry}
\begin{document}
blah blah blah
\include{SandM.tex}
yada yada yada
\end{document}
-------------------------------------
Code: Select all
% Graphical Spring and Mass system
\begin{center}
\begin{tikzpicture}
% \draw[step=0.25cm,color=gray] (-1,-1) grid (1,1);
% \draw [->] (-1.5,0) -- (1.5,0) node [below] {$x$};
% \draw [->] (0,-1.5) -- (0,1.5) node [left] {$y$};
% Left wall
\draw[very thick] (0,-.5) -- (0,.5);
% First spring (s_0)
\draw (0,0) -- (0+.25,0);
\draw (0+.375,-.0125) ellipse (1.25mm and 1.25mm)
(0+.500,-.0125) node [above,outer sep=2pt,name=s0] {$s_0$} ellipse (1.25mm and 1.25mm)
(0+.625,-.0125) ellipse (1.25mm and 1.25mm);
\draw (0+.75,0) -- (0+1,0);
% First two masses and two springs (m_1, s_1, m_2, s_2)
\foreach \x in {1,2} {
% Mass (it's just a rectangle)
\draw ((1.75*\x-.75,0) node[draw,rectangle,name=m\x,anchor=west] {$m_\x$};
% Spring (three circles with connecting lines on the ends).
\draw (1.75*\x,0) -- (1.75*\x+.25,0);
\draw (1.75*\x+.375,-.0125) ellipse (1.25mm and 1.25mm)
(1.75*\x+.500,-.0125) node [above,outer sep=2pt,name=s\x] {$s_\x$} ellipse (1.25mm and 1.25mm)
(1.75*\x+.625,-.0125) ellipse (1.25mm and 1.25mm);
\draw (1.75*\x+.75,0) -- (1.75*\x+1,0);
}
% Ellipses
\foreach \i in {0,...,2} {
\path (4.65+\i*.1,0) coordinate (X\i);
\fill (X\i) circle (1pt);
}
% First post-ellipses spring (s_{N-1})
\draw (5,0) -- (5.25,0);
\draw (5.375,-.0125) ellipse (1.25mm and 1.25mm)
(5.500,-.0125) node [above,outer sep=2pt,name=sN-1] {$s_{N-1}$} ellipse (1.25mm and 1.25mm)
(5.625,-.0125) ellipse (1.25mm and 1.25mm);
\draw (5.75,0) -- (6,0);
% Last mass and spring (m_n, s_n).
\foreach \x in {1} {
% Mass (it's just a rectangle)
\draw (6,0) node[draw,rectangle,name=mn,anchor=west] {$m_N$};
% Spring (three circles with connecting lines on the ends).
\draw (6.8,0) -- (6.8+.25,0);
\draw (6.8+.375,-.0125) ellipse (1.25mm and 1.25mm)
(6.8+.500,-.0125) node [above,outer sep=2pt,name=sn] {$s_N$} ellipse (1.25mm and 1.25mm)
(6.8+.625,-.0125) ellipse (1.25mm and 1.25mm);
\draw (6.8+.75,0) -- (6.8+1,0);
}
\draw[very thick] (7.8,-.5) -- (7.8,.5);
% The original spring and mass.
% \draw (0,0) -- (.25,0);
% \draw (.375,-.0125) ellipse (1.25mm and 1.25mm)
% (.500,-.0125) node [above,outer sep=2pt,name=s0] {$s_0$} ellipse (1.25mm and 1.25mm)
% (.625,-.0125) ellipse (1.25mm and 1.25mm);
%
% \draw (.75,0) -- (1,0);
%% \draw (1,-.25) rectangle (2,.25) (1.5,0) node [name=m0] {$m_0$};
% \draw (1,0) node[draw,rectangle,name=m0,anchor=west] {$m_0$};
\end{tikzpicture}
\end{center}
% Jeff's picture using LaTeX's native 'picture' environment.
%\begin{picture}(0,0)
% % A (left) spring and mass.
% \newsavebox{\SandM}
% \savebox{\SandM}(28,10)[bl]{
% \put(0,5){\line(1,0){8}}
% \put(8,5){\circle{3}}
% \put(10,5){\circle{3}}
% \put(12,5){\circle{3}}
% \put(12,5){\line(1,0){8}}
% \put(20,2){\line(0,1){6}}
% \put(20,2){\line(1,0){8}}
% \put(20,8){\line(1,0){8}}
% \put(28,2){\line(0,1){6}}
% }
%
% % Left wall.
% \put(0,0){\line(0,1){10}}
%
% % First two masses.
% \multiput( 0,0)(28,0){2}{\usebox{\SandM}}
% \put(56,5){\line(1,0){8}}
%
% % Elipses (well, sorta).
% \put(67,5){\circle{0}}
% \put(69,5){\circle{0}}
% \put(71,5){\circle{0}}
%
% % Last two masses.
% \multiput(74,0)(28,0){2}{\usebox{\SandM}}
% \put(130,5){\line(1,0){8}}
%
% % Right wall.
% \put(138,0){\line(0,1){10}}
%
% % Springs' and mass' labels.
% \put(6,15){$s_0$}
% \put(17,15){$m_0$}
%
% \put(33,15){$s_1$}
% \put(45,15){$m_1$}
%
% \put(105,15){$s_n$}
% \put(117,15){$m_n$}
%\end{picture}