Hello,
I am trying to curve-fit a two-parameter model to some exp. data to determine the two parameter of the model.
The code I am using is from an online example which I have modified accordingly (I am new to MATLAB....) and it gives me nice fits, however the values for the two constant i am getting range in [0, inf] and as a result have no physical meaning. I would like to introduce some limits to the search (lb, ub) but when I try to switch from fminsearch to fmincon I get error msgs of the type 'FMINCON only accepts inputs of data type double'
In sort, I am trying to switch from this:
[k0,ss0] = fminsearch(@myodeLSS,k00,[],data);
to this:
[x,fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub)
and introduce lb and ub in the search, but it just won't happen...
Any help appreciated...
Thanks

 Réponse acceptée

Geoff
Geoff le 19 Mar 2012

0 votes

At the risk of sounding patronising, I guess the first question is whether your inputs really are doubles. That error message is trying to tell you something! =)
Use the class() function on each of the matrices/values you are passing into the function to tell you if they are of type double.

1 commentaire

Nicolas Ioannidis
Nicolas Ioannidis le 20 Mar 2012
Hey Geoff,
Thanks for your suggestion. I used class() function and indeed one of my inputs ('data') is a structure. However what I don't understand is, since 'data' is a structure how come I don't get the same error message when I run fminsearch. Also, do you have any idea what the two brackets between 'koo' and 'data' are for? Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by