Home > pointing > gof_pt_mod.m

gof_pt_mod

PURPOSE ^

gof=gof_pt_mod(tm,modfunc,oaz,oel,iaz,iel,xerrs,yerrs)

SYNOPSIS ^

function gof=gof_pt_mod(tm,modfunc,oaz,oel,iaz,iel,xerrs,yerrs)

DESCRIPTION ^

 gof=gof_pt_mod(tm,modfunc,oaz,oel,iaz,iel,xerrs,yerrs)

 Goodness of fit function used to compare online oaz,oel points to
 those derived from ideal iaz,iel using modfunc(tm,iaz,iel)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function gof=gof_pt_mod(tm,modfunc,oaz,oel,iaz,iel,xerrs,yerrs)
0002 % gof=gof_pt_mod(tm,modfunc,oaz,oel,iaz,iel,xerrs,yerrs)
0003 %
0004 % Goodness of fit function used to compare online oaz,oel points to
0005 % those derived from ideal iaz,iel using modfunc(tm,iaz,iel)
0006 
0007 [maz,mel]=feval(modfunc,tm,iaz,iel);
0008 
0009 % take model values and observed values, find chi-square for az, el.
0010 % weight by errors, and insert cos(el) depenedence to az
0011 d2r=pi/180;
0012 % Change to radians
0013 %xerrs=xerrs/d2r;yerrs=yerrs/d2r;
0014 %oaz=d2r*oaz;oel=oel*d2r;maz=maz*d2r;mel=mel*d2r;
0015 
0016 % Need to change errors from XY to AzEl.
0017 if(nargin<8)
0018   az_errs = ones(size(iel));
0019   el_errs = ones(size(iel));
0020 else
0021 %  az_errs=xerrs./cos(d2r*iel);
0022 %  el_errs=yerrs;
0023 end
0024 az_errs = xerrs;
0025 el_errs = yerrs;
0026 
0027 % Weight the offset by the error, weight the az differences by cos(el)
0028 chi_az=(maz-oaz)./az_errs;
0029 chi_el=(mel-oel)./el_errs;
0030 chisq_az=sum(chi_az.^2);
0031 chisq_el=sum(chi_el.^2);
0032 
0033 gof=chisq_az+chisq_el;
0034

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005