%% $Id: pst-fit-doc.tex 881 2024-03-17 20:32:53Z herbert $
\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,
   smallheadings, headexclude,footexclude,oneside]{pst-doc}
\usepackage[utf8]{inputenc}
\usepackage{pst-fit}
\let\pstFitFV\fileversion

\usepackage{biblatex}
\addbibresource{\jobname.bib}

\input{pst-fit-doc.data}
\readdata[ignoreLines=0]{\Gauss}{gauss.dat}
\readdata[ignoreLines=0]{\Power}{power.dat}
\readdata[ignoreLines=0]{\King}{king.dat}
\readdata[ignoreLines=0]{\Exp}{exp.dat}
\readdata[ignoreLines=0]{\Linear}{linear.dat}
\readdata[ignoreLines=0]{\LinearA}{linearA.dat}
\readdata[ignoreLines=0]{\Recip}{recip.dat}
\readdata[ignoreLines=0]{\Poly}{poly.dat}
\readdata[ignoreLines=0]{\Logt}{logt.dat}
\readdata[ignoreLines=0]{\Loge}{loge.dat}


\renewcommand\bgImage{%
\begin{psgraph}[arrows=<->,Dy=20](0,0)(0,0)(10,100){2in}{2in}
\listplot[decimals=2,EqPos=5 50,plotstyle=GLLSR,RecipFit,linestyle=dashed]{\Recip}
\listplot[plotstyle=dots]{\Recip}
\end{psgraph}
}

\let\Section\section
\def\section{\clearpage\Section}
\begin{document}

\title{\texttt{pst-fit}}
\subtitle{Curve fitting; v.\pstFitFV}
\author{Buddy Ledger\\
Herbert Voß}
\docauthor{}
\date{\today}
\maketitle

\tableofcontents
%
%
%
\psset{xAxisLabel=x, %Setup for psgraph env
        yAxisLabel=y,
        xAxisLabelPos=,
        yAxisLabelPos=,
        lly=-1cm,llx=-1cm}

\section{Fit of Linear Function}
%Replaces LSM using default options

\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dy=2](0,0)(0,0)(10,22){4.5in}{4.5in}
\listplot[decimals=2,EqPos=3 15,plotstyle=GLLSR,linestyle=dashed]{\Linear}
\listplot[plotstyle=dots,linecolor=red,dotscale=2,dotstyle=x]{\Linear}
\end{psgraph}
\end{LTXexample}

\section{Fit of Power Function}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dy=100](0,0)(0,0)(10,1000){4.5in}{4.5in}
\listplot[decimals=2,EqPos=1 800,linestyle=dashed,plotstyle=GLLSR,PowerFit]{\Power}
\listplot[plotstyle=dots,linecolor=red,dotscale=2,dotstyle=x]{\Power}
\listplot[EqPos=5 4,plotstyle=GLLSR,linecolor=blue,CustomFit,CheckZeroX,CheckZeroY,FYtrans=log,RYtrans=10 exch exp,FXtrans=log]{\Power}
\end{psgraph}
\end{LTXexample}

\section{Fit of exp Function}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=1000,xsubticks=1,ysubticks=1](0,0)(0,0)(10,10000){4.5in}{4.5in}
\listplot[PstDebug=1,decimals=2,EqPos=4 2000,MaPos=5 7000,plotstyle=GLLSR,ExpFit]{\Exp}
\listplot[plotstyle=dots]{\Exp}
\end{psgraph}
\end{LTXexample}

\section{Fit of Log10/Loge Functions}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=2,xsubticks=1,ysubticks=1](0,0)(0,0)(10,50){4.5in}{4.5in}
\listplot[decimals=2,EqPos=5 10,plotstyle=GLLSR,LogTFit]{\Logt}
\listplot[decimals=2,plotstyle=dots]{\Logt}
\listplot[decimals=2,EqPos=5 28,plotstyle=GLLSR,LogEFit]{\Loge}
\listplot[decimals=2,plotstyle=dots]{\Loge}
%\listplot[EqPos=5 4,plotstyle=GLLSR,CustomFit,CheckZeroX=true,CheckZeroY=true,FYtrans=Yint dup mul sub %log,RYtrans=10 exch exp Yint dup mul add,FXtrans=log]{\Linear}
\end{psgraph}
\end{LTXexample}



\section{Fit of Recip}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=<->,Dx=1,Dy=10,xsubticks=1,ysubticks=1](0,0)(0,0)(10,100){4.5in}{4.5in}
\listplot[decimals=2,EqPos=5 2,plotstyle=GLLSR,RecipFit]{\Recip}
\listplot[plotstyle=dots]{\Recip}
\end{psgraph}
\end{LTXexample}

\section{Fit of Kings Law data}

\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=1,xsubticks=1,ysubticks=1](0,0)(0,0)(10,20){4.5in}{4.5in}
\pstScalePoints(1,1){}{dup mul}
\listplot[decimals=2,EqPos=5 2,plotstyle=GLLSR,PowerFit,Yint=5]{\King}
\listplot[plotstyle=dots]{\King}
\pstScalePoints(1,1){}{}
\end{psgraph}
\end{LTXexample}

\section{Fit of Guassian}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=0.1,xsubticks=1,ysubticks=1](0,0)(-10,0)(10,1){4.5in}{4.5in}
\listplot[plotstyle=dots]{\Gauss}
\listplot[decimals=2,EqPos=5 0.4,plotstyle=GLLSR,GaussFit,plotpoints=400]{\Gauss}
\end{psgraph}
\end{LTXexample}

\section{Fit of 4th Order Polynomial}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=100,xsubticks=1,ysubticks=1](0,0)(0,-600)(10,600){4.5in}{4.5in}
\listplot[plotstyle=dots]{\Poly}
%note that the valuewidth needs to be large for debugging matrices
\listplot[valuewidth=20,PstDebug=1,decimals=2,EqPos=0.5 -200,plotstyle=GLLSR,MaPos=7 500,MaScale=0.5,PolyOrder=4,plotpoints=400,Yint=500]{\Poly}
\listplot[linestyle=dashed,decimals=2,EqPos=0.5 -400,plotstyle=GLLSR,PolyOrder=4,plotpoints=400]{\Poly}
%\listplot[decimals=2,EqPos=0.5 -200,plotstyle=GLLSR,PolyOrder=10,plotpoints=400]{\Power}
\end{psgraph}
\end{LTXexample}

\section{LinetoXAxis respects scalepoints.}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=<->,Dx=1,Dy=1,xsubticks=1,ysubticks=1](0,0)(0,0)(10,10){4in}{4in}
\pstScalePoints(0.5,0.25){2 add}{16 add}
\listplot[plotstyle=line]{\Linear}
\listplot[arrows=<-,plotstyle=LineToXAxis]{\Linear}
\pstScalePoints(1,1){}{}
\rput[lb](1,2){Scaled fluid velocity distribution on a plot of the physical system.}
\end{psgraph}
\end{LTXexample}

\section{Prepare Points Modification}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=1,xsubticks=1,ysubticks=1](0,0)(0,0)(15,30){4.5in}{4.5in}
\listplot[plotstyle=line,plotNoMax=2,plotNo=1]{\LinearA}
\listplot[plotstyle=line,plotNoMax=2,plotNo=2]{\LinearA}
\listplot[plotstyle=line,linestyle=dashed,plotNoMax=2,plotNo=1,plotNoTwo=2,plotNoTwoFunc=add 2 div]{\LinearA}
\rput[lb](10,18){1st Column}
\rput[lb](10,29){2nd Column}
\rput[lb](10,24){Average of 1st and 2nd Columns}
\end{psgraph}
\end{LTXexample}

\section{PrintCoor Demo}
\begin{LTXexample}[pos=t]
\begin{psgraph}[arrows=->,Dx=1,Dy=1,xsubticks=1,ysubticks=1](0,0)(0,0)(10,15){4.5in}{4.5in}
%PrintCoor Demo
\psset{xEnd=,xStart=,decimals=2,valuewidth=50,fontscale=10,PstDebug=1}
\pstScalePoints(1,1){0.75 mul}{0.5 exp 3 mul}
\listplot[plotstyle=PrintCoor,plotNoMax=1,plotNo=1,PstDebug=0,relxerr=0,relyerr=0.1]{\Linear}
\listplot[plotstyle=dots,plotNoMax=1,plotNo=1]{\Linear}
\pstScalePoints(1,1){}{}
\end{psgraph}
\end{LTXexample}

\clearpage
\section{List of all optional arguments for \texttt{pst-fit}}

\xkvview{family=pst-fit,columns={key,type,default}}




\bgroup
\raggedright
\nocite{*}
\printbibliography
\egroup

\printindex





\end{document}

