For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > lsqcurvefit









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author lsqcurvefit
george

2005-11-11, 7:04 pm

> I have some trouble using lsqcurvefit function.
> I have data (x,y) and I want to use lsqcurvefit to fit them. I am
> using the follooing function
> lsqcurvefit('test',beta,x,y,LB,UB,option
s);
> as described in the manual. The number of parameters I am using

that
> will be determined by the fitting procedure is 4.
> The question I have is that if y(1)=g(beta(2)) (that is a function

of
> beta(2) how could I include it in the lsqcurvefit (because as it
> stands now, it will consider as Y(1) only the value derived by

taking
> a trial value for beta(2)


Yes, exactly. Let me be more specific:
Let's consider the values for x and y
x=[ 1 2 3 4 5 ]
y=[ Yo 2 3 4 5];

beta(1)=Yo;

'Yo' is a value that is set as a parameter which means that I set
initially an estimate for that and then I set the upper and lower
limit before I use use the
lsqcurvefit('test',beta,x,y,LB,UB,option
s); function

When I load the lsqcurvefit routine, is it going always to consider
y=[ Yo 2 3 4 5] during the fitting procedure or it will use y=[ beta
2 3 4 5] in which 'beta' is a running variable which changes during
the iterations

Thanks
Giorgio
John D'Errico

2005-11-11, 7:04 pm

In article <ef1b2b6.-1@webx.raydaftYaTP>, george <george@yahoo.it>
wrote:

> that
> of
> taking
>
> Yes, exactly. Let me be more specific:
> Let's consider the values for x and y
> x=[ 1 2 3 4 5 ]
> y=[ Yo 2 3 4 5];
>
> beta(1)=Yo;
>
> 'Yo' is a value that is set as a parameter which means that I set
> initially an estimate for that and then I set the upper and lower
> limit before I use use the
> lsqcurvefit('test',beta,x,y,LB,UB,option
s); function
>
> When I load the lsqcurvefit routine, is it going always to consider
> y=[ Yo 2 3 4 5] during the fitting procedure or it will use y=[ beta
> 2 3 4 5] in which 'beta' is a running variable which changes during
> the iterations


Please don't start a new thread when you respond.
Instead post responses as a continuation to the
existing thread.

You want to use lsqnonlin for this. Lsqcurvefit
assumes that y stays fixed. Lsqnonlin forces you
to generate the residuals yourself, so it does
not care what y is.

HTH,
John D'Errico


--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

Those who can't laugh at themselves leave the job to others.
Anonymous
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com