I guess this is a really tricky question and might solved with a good amount of mathmatical knowledge. But first things first:
I want to execute a fit with a custom equation in cftool. The problem remains in the fact that the function consist of case differentation:
- atan((2*d*w)/(v^2-w^2)) for w < v
- π/2 for w = v
- π/2 + atan((2*d*w)/(v^2-w^2)) for w > v
with w being 'x'
Actually I got handed the solution: fitting with :
acos((v^2 - w^2)/sqrt((2*d*w)^2 + (v^2 - w^2)^2)).
But how you hade have approached that problem?