On Nov 18, 2011, at 7:10 AM, preeti gaikwad wrote:
>
> On 18 November 2011 12:55, Ben Abbott <
address@hidden> wrote:
>
>> On Nov 18, 2011, at 6:30 AM, preeti gaikwad <
address@hidden> wrote:
>>
>>> Hello all,
>>>
>>> I am thee new user of octave could u please help me?
>>> I am getting this error using "
>>> weighted residuals are not real
>>> error: called from:
>>> error: /usr/share/octave/packages/3.2/optim-1.0.12/leasqr.m at line 394, colu
>>> mn 4"
>>>
>>> do not understand why using leasqr to fit my data.....when I hv 20 points i dont hv this problem but still it is not fitting well but if i reduce some points i m getting this error....could u please tell me why it is so?
>>
>> Can you show us what you did to cause this error?
>>
>> Perhaps a simple example we can try ourselves?
>>
>> Ben
>
> Function body:::::::::::::::::::::
>
>
> function F = trans_fnc(x,p) %
>
> if nargin~=2
> error('This function is waiting for 2 arguments')
> end
>
> ls = p(1); % in um
> la = p(2);% in um
> offset = 0.0;
> c=0.3; %speed of light in um/fs
> n1 = 1.05; % average refractive index
> n2 = 1;
> R =((n1-n2)/(n1+n2))^2;
> z0 = (2/3)*ls*(1+R)/(1-R);
> ze = (la/2)*log((1+(1/la)*z0)/(1-(1/la)*z0));
> zp = ze;
> %% model function:
> F =1.0./( (la/ze)*sinh((zp+ze)/la)*sinh(ze/la)./sinh(((x+offset)+2*ze)/la)); % inverse transmittance
> This is my function body and then I have to find the value of ls and la I have x value and y but for particular x value it is fitting but for some x its not fitting.....
>
> where using leasqr as follows
> for i=1:nr % i is the LAMBDA VARIABLE
> y=1./T(i,:);
> %% start leasqr, be sure that 'verbose' is not set
> global verbose; verbose = false;
> [f, p] = leasqr (x, y, pin,'trans_fnc', tolerance, max_iterations, weights, dp, dFdp, options);
> ls(i) = p(1);
> la(i) = p(2);
> fit(i,:) = f;
>
> end
>
> importantly i do not understand how to fixed the weighted residual in my case it is
> weights = ones (1, nc);
>
> where nc is column value for y
> thanks for ur help in advance