From: ignacio vilchis on 8 Feb 2005 00:45 Hi, I am trying to fit a vonbertalanffy growth curve to some fish growth data, using iterative least squares and the fminsearch function. The VonB function has three unknowns hence you need three initial guesses. I can assign the function to a handle ok with this command: VonB = @(Lmax,b,k) sum(((Lmax*(1-b*exp(-k*age)))-(real data)).^2) and this for the initial guess for the three parameters x0 = [100 .8 .5] but when I call for the fminsearch to find the minimun values x = fminsearch(VonB,x0) I get this, when I did define b? Any ideas? ??? Input argument "b" is undefined. Error in ==> fminsearch at 175 fv(:,1) = funfcn(x,varargin{:}); Thanks in advance for any help.
From: Peter Spellucci on 8 Feb 2005 07:43 In article <eefb168.-1(a)webx.raydaftYaTP>, "ignacio vilchis" <lvilchis(a)ucsd.edu> writes: >Hi, I am trying to fit a vonbertalanffy growth curve to some fish >growth data, using iterative least squares and the fminsearch >function. >The VonB function has three unknowns hence you need three initial >guesses. I can assign the function to a handle ok with this command: >VonB = @(Lmax,b,k) sum(((Lmax*(1-b*exp(-k*age)))-(real data)).^2) >and this for the initial guess for the three parameters >x0 = [100 .8 .5] >but when I call for the fminsearch to find the minimun values >x = fminsearch(VonB,x0) >I get this, when I did define b? Any ideas? > >??? Input argument "b" is undefined. >Error in ==> fminsearch at 175 >fv(:,1) = funfcn(x,varargin{:}); > >Thanks in advance for any help. the parameter of VonB must be a vector with three components, not three scalars since fminsearch takes one vector as optimization variable and treats other variables in a function called as "additional parameters". hth peter
From: Ignacio Vilchis on 8 Feb 2005 14:40 I thought that making the parameters as x0 = [100 .8 .5] made that into a vector having three components, that is what I have, but still get the same error message. Are you reffering to something else? Peter Spellucci wrote: > > > In article <eefb168.-1(a)webx.raydaftYaTP>, > "ignacio vilchis" <lvilchis(a)ucsd.edu> writes: > >Hi, I am trying to fit a vonbertalanffy growth curve to some fish > >growth data, using iterative least squares and the fminsearch > >function. > >The VonB function has three unknowns hence you need three initial > >guesses. I can assign the function to a handle ok with this > command: > >VonB = @(Lmax,b,k) sum(((Lmax*(1-b*exp(-k*age)))-(real data)).^2) > >and this for the initial guess for the three parameters > >x0 = [100 .8 .5] > >but when I call for the fminsearch to find the minimun values > >x = fminsearch(VonB,x0) > >I get this, when I did define b? Any ideas? > > > >??? Input argument "b" is undefined. > >Error in ==> fminsearch at 175 > >fv(:,1) = funfcn(x,varargin{:}); > > > >Thanks in advance for any help. > > the parameter of VonB must be a vector with three components, not > three scalars > since fminsearch takes one vector as optimization variable and > treats > other variables in a function called as "additional parameters". > hth > peter >
From: Marcelo Marazzi on 8 Feb 2005 17:44 Fminsearch expects the objective to depend on a vector variable instead of on separate scalar variables. (I call this vector variable "x" below, but one can use any other, more descriptive, variable name.) VonB = @(x) sum(((x(1)*(1-x(2)*exp(-x(3)*age)))-(real_data)).^2) x0 = [100 .8 .5] x = fminsearch(VonB,x0) -marcelo Ignacio Vilchis wrote: > I thought that making the parameters as > x0 = [100 .8 .5] > made that into a vector having three components, that is what I have, > but still get the same error message. Are you reffering to something > else? > > Peter Spellucci wrote: > >> >>In article <eefb168.-1(a)webx.raydaftYaTP>, >>"ignacio vilchis" <lvilchis(a)ucsd.edu> writes: >> >>>Hi, I am trying to fit a vonbertalanffy growth curve to some > > fish > >>>growth data, using iterative least squares and the fminsearch >>>function. >>>The VonB function has three unknowns hence you need three > > initial > >>>guesses. I can assign the function to a handle ok with this >> >>command: >> >>>VonB = @(Lmax,b,k) sum(((Lmax*(1-b*exp(-k*age)))-(real > > data)).^2) > >>>and this for the initial guess for the three parameters >>>x0 = [100 .8 .5] >>>but when I call for the fminsearch to find the minimun values >>>x = fminsearch(VonB,x0) >>>I get this, when I did define b? Any ideas? >>> >>>??? Input argument "b" is undefined. >>>Error in ==> fminsearch at 175 >>>fv(:,1) = funfcn(x,varargin{:}); >>> >>>Thanks in advance for any help. >> >>the parameter of VonB must be a vector with three components, not >>three scalars >>since fminsearch takes one vector as optimization variable and >>treats >>other variables in a function called as "additional parameters". >>hth >>peter >>
From: ignacio vilchis on 8 Feb 2005 17:53 thanks marcelo got it!! Marcelo Marazzi wrote: > > > Fminsearch expects the objective to depend on a vector > variable instead of on separate scalar variables. (I call > this vector variable "x" below, but one can use any other, > more descriptive, variable name.) > > VonB = @(x) sum(((x(1)*(1-x(2)*exp(-x(3)*age)))-(real_data)).^2) > x0 = [100 .8 .5] > x = fminsearch(VonB,x0) > > -marcelo > > Ignacio Vilchis wrote: >> I thought that making the parameters as >> x0 = [100 .8 .5] >> made that into a vector having three components, that is what I > have, >> but still get the same error message. Are you reffering to > something >> else? >> >> Peter Spellucci wrote: >> >>> >>>In article <eefb168.-1(a)webx.raydaftYaTP>, >>>"ignacio vilchis" <lvilchis(a)ucsd.edu> writes: >>> >>>>Hi, I am trying to fit a vonbertalanffy growth curve to some >> >> fish >> >>>>growth data, using iterative least squares and the fminsearch >>>>function. >>>>The VonB function has three unknowns hence you need three >> >> initial >> >>>>guesses. I can assign the function to a handle ok with this >>> >>>command: >>> >>>>VonB = @(Lmax,b,k) sum(((Lmax*(1-b*exp(-k*age)))-(real >> >> data)).^2) >> >>>>and this for the initial guess for the three parameters >>>>x0 = [100 .8 .5] >>>>but when I call for the fminsearch to find the minimun values >>>>x = fminsearch(VonB,x0) >>>>I get this, when I did define b? Any ideas? >>>> >>>>??? Input argument "b" is undefined. >>>>Error in ==> fminsearch at 175 >>>>fv(:,1) = funfcn(x,varargin{:}); >>>> >>>>Thanks in advance for any help. >>> >>>the parameter of VonB must be a vector with three components, not >>>three scalars >>>since fminsearch takes one vector as optimization variable and >>>treats >>>other variables in a function called as "additional parameters". >>>hth >>>peter >>> >
|
Pages: 1 Prev: There may be a singularity in the solution Next: mc-cdma |