%$Id: sin.tex,v 21.13 2002/03/25 05:37:03 al Exp $
% man behavior sin .
% Copyright (C) 2001 Albert Davis
% Author: Albert Davis <aldavis@ieee.org>
%
% This file is part of "Gnucap", the Gnu Circuit Analysis Package
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
% 02111-1307, USA.
%------------------------------------------------------------------------
\section{{\tt SIN}: Sinusoidal time dependent value}
%------------------------------------------------------------------------
\subsection{Syntax}
\begin{verse}
{\tt SIN} {\it args}\\
{\tt SIN} {\it offset amplitude frequency delay damping}
\end{verse}
%------------------------------------------------------------------------
\subsection{Purpose}

The component value is a sinusoidal function of time, with optional
exponential decay.
%------------------------------------------------------------------------
\subsection{Comments}

For voltage and current sources, this is the same as the Spice {\tt
SIN} function, with some extensions.

It generates either a steady sinusoid, or a damped sinusoid.

If {\em delay} and {\em damping} are both zero, you get a steady sine
wave at the specified {\em frequency}.  Otherwise, you get a damped
pulsed sine wave, starting after {\em delay} and damping out with a
time constant of 1/{\em damping}.

The shape of the waveform is described by the following algorithm:

\begin{verbatim}
reltime = time - _delay
if (reltime > 0.){
  ev = _amplitude * sin(2*PI*_freq*reltime);
  if (_damping != 0.){
    ev *= exp(-reltime*_damping);
  }
  ev += _offset;
}else{
  ev = _offset;
}
\end{verbatim}
%------------------------------------------------------------------------
\subsection{Parameters}

\begin{description}

\item[{\tt Offset} = {\it x}] DC offset.  (Default = 0.)

\item[{\tt Amplitude} = {\it x}] Peak amplitude.  (Default = 1.)

\item[{\tt Frequency} = {\it x}] Frequency, Hz.  (required)

\item[{\tt Delay} = {\it x}] Turn on delay, seconds.  (Default = 0.)

\item[{\tt Damping} = {\it x}] Damping factor, 1/seconds.  (Default = 0.)

\end{description}
%------------------------------------------------------------------------
%\subsection{Example} 
%------------------------------------------------------------------------
%------------------------------------------------------------------------
