Dear Mathias,
There might be a little bug in your function.
Consider the following example:
x=0:50;
y=2*x;
uxin=0.001*x;
uyin=0.002*y;
[a,b,alpha,p,chiopt,Cab,Calphap]=wtls_line(x,y,uxin,uyin)
In this case, the program fails, a=0.9064 and b=NaN.
However, if you remove the first data pair (0,0):
x=1:50;
y=2*x;
uxin=0.001*x;
uyin=0.002*y;
[a,b,alpha,p,chiopt,Cab,Calphap]=wtlsc_line(x,y,uxin,uyin)
The program works perfectly well:
a=2.0000 and b=6.6781e-007.
The same problem occurs with the latest version of the algorithm (wtlsc_line).
Congratulations for your excellent work!
Kind regards,
Ariel
Hi,
xin is the input (abscissa)
uxin is the standard (measurement) uncertainty of the x input. yin is the input of the ordinate and uyin the associated standard measurement uncertainty. The input vector uxin should have the same size as xin, i.e. for every x there should be an associated uncertainty value. The same holds for yin and uyin. Of course, the algorithm will yield the same result as an OLS algorithm if no uncertainties in x are present (uxin=zeros(size(xin)).
Comment only