2

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?

Michael L
  • 43
  • 3
  • 1
    Can you please add a [mcve], i.e. a code that *we* can run? We'll need to see your `equation`. – Adriaan Mar 10 '22 at 08:29
  • Have a look at the https://octave.org/doc/v6.4.0/Optimization.html#Optimization chapter in the manual. Specifically the non-linear part, depending on the nature of your equation. The 0 – Tasos Papastylianou Mar 10 '22 at 19:33

0 Answers0