[Ifit-users] 2D model fit in iFit
Emmanuel FARHI
farhi at ill.fr
Sat Feb 2 15:27:01 CET 2013
Hello Maria,
You should definitely upgrade to iFit 1.3, from which model definitions
are much easier, and also allow model arithmetic.
Then you can write:
>> y.Expression=@(p,x,y)p(1)*(p(3).*x+p(4).*y)+p(2).*p(5).*(p(3).*x.^2+p(4).*y.^2);
>> model.Parameters={ 'viscosity' 'density' 'dia1' 'dia2' 'mfactor' };
>> model.Guess = [1e-5 1 2 .2 1e-5];
>> model=iFunc(model); % make it a model function
>> plot(model)
>> fits(S, model, [], options, [ 1 1 0 0 0 ])
You can also define a new model from existing ones, such as:
>> model2 = model+constant
The ifitmakefunc will also work to perform the few lines above via a
dialogue box.
Emmanuel.
On Thu, January 31, 2013 20:33, Maria Thomsen wrote:
> Dear Emmanuel Farbi,
>
> I participated in your introductionary course in iFit at the University
> of Copenhagen one year ago and have used iFit ever since.
> I have now run into a problem with a self-defined model. I have measured
> the parameters x,y,p and have the following model expression for p
> model='p(1).*(p(3).*x+p(4).*y)+p(2).*p(5).*(p(3).*x.^2+p(4).*y.^2)';
>
> I want to make a fit by keeping p(1) and p(2) fixed and use p(3), p(4)
> and p(5) as fitting parameters.
> I get the error:
>
> Expression or statement is incorrect--possibly unbalanced (, {, or [.
>
> Error in ==> iData.ieval at 59
> Info = feval(model,'identify'); % get identification Info, esp. for
> Dimension
>
> Error in ==> iData.fits at 232
> [dummy, info] = ieval(a, model,'identify'); % model info
>
> Error in ==> mfactor2D_iFit at 70
> [pars, criteria, message, output]=fits(S, model, [guess.p1 guess.p2
> guess.p3 guess.p4 guess.p5],
> options, [1 1 0 0 0]);
>
> I have defined S=iData(x,y,p)
> I have also tried to define the model using "ifitmakefunc" (file
> attached), but get the same error.
>
> I have made a test in 1D, with the model
> model='p(1).*p(3).*x+p(2).*p(5).*p(3).*x.^2'; and that works fine.
>
> Hope you can help
>
> Best regards
>
> Maria Thomsen
> PhD student
> University of Copenhagen
>
--
FARHI Emmanuel <farhi at ill.fr>
Groupe DS/CS, ILL4/156, Tel 04 76 20 71 35
ILL, Grenoble
More information about the ifit-users
mailing list