Fminsearchcon uses your objective function, which for 5 parameter models, must take vector input. Thus it will pass in a vector x to the objective function that has 5 elements here. The constraint function must then also accept a vector of length 5. So your call to fminsearchcon might look like this:
Congrats again for the useful function John. I just have a qestion: i'm trying to use fminsearchcon in a 5 parameter function i've created:
(...) Here there is a long script but, at the end, the important thing are the input and outputs (...)
What I wonder is to find the parameters that optimize the error function. These parameters are interelated by the non-linear constrain:
The problem is that I don't know how to implement this constrain, the examples I have seen are just with one parameter. I have tried this:
But, of course, it doesn't recognise what is x2, x3, x4, or x5 because it is defined nowhere.
Any clue?? Thanks in advance! :)