%$Id: fourier.tex,v 21.13 2002/03/25 05:37:03 al Exp $
% man commands fourier .
%------------------------------------------------------------------------
\section{{\tt FOURIER} command}
\index{fourier command}
\index{spectrum analysis}
\index{frequency domain: nonlinear}
\index{nonlinear analysis: frequency domain}
%------------------------------------------------------------------------
\subsection{Syntax}
\begin{verse}
{\tt Fourier} {\it start stop stepsize} \{{\it options} ...\}
\end{verse}
%------------------------------------------------------------------------
\subsection{Purpose}

Performs a nonlinear time domain (transient) analysis, but displays the
results in the frequency domain.

{\it Start}, {\it stop}, and {\it stepsize} are frequencies.
%------------------------------------------------------------------------
\subsection{Comments}

This command is slightly different and more flexible than the SPICE
counterpart.  SPICE always gives you the fundamental and 9 harmonics.
Gnucap will do the same if you only specify one frequency.  SPICE has
the probes on the same line.  Gnucap requires you to specify the probes
with the {\tt print} command.  

SPICE uses the last piece of a transient that was already done.  Gnucap
does its own transient analysis, continuing from where the most recent
one left off, and choosing the step size to match the Fourier
Transform to be done.  Because of this the Gnucap Fourier analysis is
much more accurate than SPICE.

The nodes to look at must have been previously selected by the {\tt
print} or {\tt plot} command.

Three parameters are normally needed for a Fourier analysis: start
frequency, stop frequency and step size, in this order.

If the start frequency is omitted it is assumed to be 0.  The two
remaining parameters are stop and step, such that stop $>$ step.

If only one frequency is specified, it is assumed to be step size,
which is equivalent to the fundamental frequency.  The start
frequency is zero and the stop frequency is set according the {\tt
harmonics} option (from the {\tt options} command.  The default is
9 harmonics.

If two frequencies are specified, they are stop and step.  The
order doesn't matter since stop is always larger than step.

Actually, this command does a nonlinear time domain analysis, then
performs a Fourier transform on the data to get the frequency data.
The transient analysis parameters (start, stop, step) are determined
by the program as necessary to produce the desired spectral results.
The internal time steps are selected to match the Fourier points,
so there is no interpolation done.

The underlying transient analysis begins where the previous one
left off.  If you specify the "cold" option, it begins at time =
0.  Often repeating a run will improve the accuracy by giving more
time for initial transients to settle out.

See also: {\tt Transient} command.
%------------------------------------------------------------------------
\subsection{Options}

\begin{description}

%%%\item[{\tt <} {\it file}] Get circuit input from {\it %%% file}.

\item[{\tt >} {\it file}] Send results of analysis to {\it file}.

\item[{\tt >>} {\it file}] Append results to {\it file}.

%%%\item[{\tt ACMAx}] Use worst case max values, per last
%%%{\tt AC} analysis.

%%%\item[{\tt ACMIn}] Use worst case min values, per last
%%%{\tt AC} analysis.

\item[{\tt Cold}] Zero initial conditions.  Cold start from power-up.

%%%\item[{\tt DCMAx}] Use worst case max values, per last
%%%{\tt DC} or {\tt OP} analysis.

%%%\item[{\tt DCMIn}] Use worst case min values, per last
%%%{\tt DC} or {\tt OP} analysis.

%%%\item[{\tt Echo}] Echo disk reads to console, when input
%%%is from a file.

%%%\item[{\tt LAg}] Use worst case values, for lagging phase,
%%% per {\tt AC} analysis.

%%%\item[{\tt LEad}] Use worst case values, for leading
%%% phase, per {\tt AC} analysis.

\item[{\tt Quiet}] Suppress console output.

\item[{\tt SKip} {\it count}] Force at least {\it count} internal
transient time steps for each one used.

\item[{\tt STiff}] Use a different integration method,
that will suppress overshoot when the step size is too
small.

\item[{\tt TEmperature} {\it degrees}] Temperature,
degrees C.

\item[{\tt TRACe} {\it n}] Show extended information during solution.
Must be followed by one of the following:
\begin{description}
\item[{\tt Off}] No extended trace information (default, override .opt)
\item[{\tt Warnings}] Show extended warnings
\item[{\tt Alltime}] Show all accepted internal time steps.
\item[{\tt Rejected}] Show all internal time steps including rejected steps.
\item[{\tt Iterations}] Show every iteration.
\item[{\tt Verbose}] Show extended diagnostics.
\end{description}

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

\begin{description}

\item[{\tt fourier 1Meg}] Analyze the spectrum assuming a fundamental
frequency of 1 mHz.  Use the {\tt harmonics} option to determine
how many harmonics (usually 9) to display.

\item[{\tt fourier 40 20k 20}] Analyze the spectrum from 40 Hz to 20 kHz in
20 Hz steps.  This will result in a transient analysis with 25 micro-second
steps.  (1 / 40k).  It will run for .05 second.  (1 / 20).

\item[{\tt fourier 0 20k 20}] Similar to the previous example, but show the
DC and 20 Hz terms, also.

\item[{\tt fourier}] No parameters mean use the same ones as the last time.
In this case: from 0 to 20 kHz, in 20 Hz steps.

\item[{\tt fourier Skip 10}] Do 10 transient steps internally for every step
that is used.  In this case it means to internally step at 2.5 micro-second,
or 10 steps for every one actually used.

\item[{\tt fourier Cold}] Restart at time = 0.  This will show the
spectrum of the power-on transient.

%%%\item[{\tt fourier >arun}] Save the results of this run in the file {\tt
%%% arun}.

%%%\item[{\tt fourier <aninput}] Use the file {\tt aninput} as a user
%%% defined input.  It substitutes for the signal generator.

\end{description}
%------------------------------------------------------------------------
%------------------------------------------------------------------------
