in Octave: Is there a way of constraining a couple of parameters (not all) in a minimizer like fminsearch?

136 Views Asked by At

I'm trying to find the optimal fit of a function based on a couple of parameters. I do this in steps to get full functionality and best fit.

However... some times I see that 2 of the parameters are way off what they should be.

I'm wondering how search for best fit of an equation if 2 of the parameters needs to be limited.

For instance: x and y needs te be above zero but never over 1. x needs to be lower than y.

In short: 0 < x < y < 1

But I also have to find out the answers to z and q. They can be whatever. Is that even possible in Octave?

My startvalues is:

x = 0,1

y = 0,4

z = 16

q = 200

Below is a snippet of the current code. 

StartP = [x y z q];
SP = StartP;
options = optimset('MaxIter',16000);
options = optimset(options,'MaxFunEval',16000);

data = fminsearch(@equation,SP,options); 

Every once in a while I get really high values for x and y. If I just remove the x and y from the fminsearch and leave them at their starting points it looks fairly good... but not excellent.

Is there away around this problem?

0

There are 0 best solutions below