%$Id: sin.tex,v 25.95 2006/08/26 01:26:53 al Exp $ -*- LaTeX -*-
% 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., 51 Franklin Street, Fifth Floor, Boston, MA
% 02110-1301, 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}

For other components, it gives a time dependent value.

As an extension beyond Spice, you may specify the parameters as
name=value pairs in any order.
%------------------------------------------------------------------------
\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} 
%------------------------------------------------------------------------
%------------------------------------------------------------------------
