CCL Home Page
Up Directory CCL STEPITDRIVER2.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is the driver file for STEPIT.                      				%
%																							%
% Basically, this is what you use if you want to fit a model			%
% This program calls STEPIT10, which calls the various other			%
% subroutines.																			%
%																							%
% Please refer to README.txt for further details							%
% 																							%
% STEPIT was originally written by J.P. Chandler							%
%																							%
% Ported to Matlab by Jason Lott, University of Alabama at Birmingham%
% hoffa@uab.edu																		%
%																							%
%																							%
% PLEASE SEE USER SPECIFIC SECTIONS#1-5 BELOW TO CUSTOMIZE FOR YOUR  %
% PARTICULAR MODEL. ALSO BE SURE TO MODIFY private_FUNK.m TO SPECIFY	%
% YOUR MODEL. NO OTHER MODIFICATIONS IN ANY OTHER FILES ARE 			%
% NEEDED. 																				%						
%																							%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function a = STEPITDRIVER2(b)

global T
global Y
global YSIG
global X
global NVMAX
global MAXSTP
global FACUP
global ACK
global STCUT
global MAXOSC
global MINOSC
global NPTS

global X
global XMAX
global XMIN
global DELTX
global DELMIN
global ERR
global FOBJ
global VEC
global DLX
global XS
global FSTORE
global DX
global SALVO
global XOSC
global FOSC
global ARG
global STCUT
global ACK
global FACUP
global RZERO
global XPLUS
global FSAVE
global FBEST
global XSAVE
global ABSDX
global FPREV
global DENOM
global DEL
global DXZ
global DXU
global DFZ
global DFU
global ABSVEC
global SUMV
global CINDER
global COXCOM
global COSIN
global STEPS
global J
global JFLAT
global JFLMIN
global JOCK
global JUMP
global JVARY
global JX
global K
global KERFEL
global KL
global KW
global MASK
global MATRX
global MINSOC
global MAXOSC
global MAXSTP
global NACK
global NACTIV
global NAH
global NCIRC
global NEQUAL
global NF
global NFLAT
global NFMAX
global NFSAV
global NGATE
global NGIANT
global NONZER
global NOREP
global NOSC
global NOUT
global NRETRY
global NSSW
global NSTEPS
global NT
global NTRACE
global NV
global NEXTRA
global NZIP
global tag_380
global tag_390
global wtag
global tag
global continueflag
global T
global Y
global YSIG
global grandtag
global KFLAG
global DX
global XS
global DLX
global fortag
global KFLAGENCOUNTER


disp('Welcome to STEPIT for Matlab')

disp('-----------------------------------------');
disp(' ')

disp('This program fits data to a particular 3-parameter model, as defined by FUNK.')
disp('See the FUNK file or README.txt for particulars.')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% USER SPECIFIC SECTION#1
%
%
% NV and NVMAX MUST BE ADJUSTED PER MODEL. HERE # OF PARAMETERS = 3 (NV=3) WHILE MAX # = 20 (NVMAX = 20)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

NV = 3;						
NVMAX = 20;
MAXSTP = 3;
FACUP = 4.0D0;
ACK = 2.0D0;
STCUT = 10.0D0;
MAXOSC = 5;
MINOSC = 2;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% USER SPECIFIC SECTION#2
%
% MODIFY DATA MATRICES T AND Y AND YSIG OR WHATEVER FOR YOUR MODEL HERE. BE SURE TO ADJUST private_FUNK.m AS WELL!!!	 %
% 																																				 %
% ENTER FILE PATHS FOR DATA at INPUT SECTION																						 %																																				 %
%																																			       %
% Matrix T holds data for 2 independent variables; Y holds independent variable; YSIG holds variance data for each point %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


NPTS = input('Please enter the number of points to be fit: ')
T = zeros(NPTS,2);
Y = zeros(NPTS,1);
YSIG = zeros(NPTS,1);
X = zeros(NV,1);																														
XMAX = zeros(NV,1);
XMIN = zeros(NV,1);
XMAX = zeros(NV,1);
DELTX = zeros(NV,1);
DELMIN = zeros(NV,1);
ERR = zeros(NV,NVMAX+1);
MASK = zeros(NV,1);
VEC = zeros(NV,1);
FSTORE = zeros(NV,1);
SALVO = zeros(NV,1);
JFLAT = zeros(NV,1);
XOSC = zeros(NV,MAXOSC);
FOSC = zeros(MAXOSC);

DX = zeros(NV,1);
XS = zeros(NV,1);
DLX = zeros(NV,1);


disp(' ');
fileindvar1 = input('Please enter the file path for independent variable 1 data points: ')
fileindvar2 = input('Please enter the file path for independent variable 2 data points: ')
filevar = input('Please enter the file path for dependent variable data points: ')
filesig = input('Please enter the file path containing the sig information: ')

fid1 = fopen(fileindvar1, 'r');
fid2 = fopen(fileindvar2, 'r');
fid3 = fopen(filevar, 'r');
fid4 = fopen(filesig, 'r');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% USER SPECIFIC SECTION#3
%
%
% The following FOR LOOP reads in DATA from FILES above to MATRICES T, Y and YSIG. AGAIN, this must be changed
% according to the model in question. 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i=1:NPTS
   
   line1 = fgetl(fid1);
   line1 = str2num(line1);
   line2 = fgetl(fid2);
   line2 = str2num(line2);
   line3 = fgetl(fid3);
   line3 = str2num(line3);
   line4 = fgetl(fid4);
   line4 = str2num(line4);
   
   
   T(i,1) = line1;											
   T(i,1) = T(i,1);
   T(i,2) = line2;
   Y(i) = line3;
   YSIG(i) = line4;
   
end



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do some initialization for STEPIT; such as initialize parameter values				  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




private_STSET(1);											%Call STSET to initialize STEPIT



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% USER SPECIFIC SECTION#4																				  %
%																												  %
% ENTER INITIAL GUESSES TO MODEL PARAMETERS BELOW										        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

X(1) = 10.0;											
X(2) = 1.0;
X(3) = 1.0;

STEPIT10(1);



   
   

   
   
   






Modified: Mon Jul 23 19:36:56 2001 GMT
Page accessed 5201 times since Wed Aug 15 00:39:30 2001 GMT