help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weighted residuals are not real


From: Ben Abbott
Subject: Re: weighted residuals are not real
Date: Fri, 18 Nov 2011 09:13:11 -0500

On Nov 18, 2011, at 8:55 AM, preeti gaikwad wrote:

> On 18 November 2011 14:46, Ben Abbott <address@hidden> wrote:
> 
>> On Nov 18, 2011, at 8:27 AM, preeti gaikwad wrote:
>> 
>> > On 18 November 2011 14:21, Ben Abbott <address@hidden> wrote:
>> >
>> >> 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
>> >>
>> >> Please reply at the bottom of the email so that those arrive later can 
>> >> follow along. Also, these emails are archived in several places on the 
>> >> web. Using plain text ensures they'll be reproduced accurately. So, 
>> >> please don't post in html or rtf.
>> >>
>> >> Regarding you problem can you provide all the inputs to leasqr?
>> >>
>> >> Ben
>> >
>> > thanks ben....yes i m giving the guess value
>> >
>> > pin = [0.1 3];% ls;la
>> > options.bounds=[0.0001 10;0.001 100];
>> > and this guess was almost near to the calculated value but dont know why 
>> > its not fitting
>> 
>> Ok, what what of the other inputs?
>> 
>>        tolerance
>>        max_iterations
>>        dp
>>        dFdp
>> 
>> Ben
> 
> rest inpƻts are 
> 
> tolerance = .000001;
> 
> max_iterations = 1000;
> weights = ones (1, nc);
> dp = [.0001; .0001]; % bidirectional numeric gradient stepsize
> dFdp = 'dfdp'; % function for gradient (numerical)

Ok. I'll need the dfdp.m function also.

Ben

p.s. please reply below, so that those arrive later can follow along.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]