Working with lsqcurvefit: edit optimization options structure

Hi,
i tried to fix some Data to the folling function:
function Z = FitFunc(p, f ) % Vector p must be [R1, C1, R2, C2]'
Z = abs( 1 ./ (1/p(1) + i*2*pi*f*p(2)) + 1 ./ (1/p(3) + i*2*pi*f*p(4)));
end
The function represents a electric circuit.
%for f i used:
f = logspace(1,6)
%for p:
p = [1000, 1e-9, 10, 1e-7]
%after saving for y:
y = FitFunc(p,f);
%i tried to fix the problem with the following startvalues
p2 = [1100, 5e-9, 22, 5.5e-7]
[x, resnorm] = lsqcurvefit(@FitFunc, p2, f, y);
%But Matlab the says: %Local minimum possible.
%lsqcurvefit stopped because the size of the current step is less %than the default value of the step size tolerance.
%<stopping criteria details>
%i already worked with optimset:
options = optimset('TolX', 1e-12, 'TolFun', 1e-12, 'MaxFunEvals', 4000, 'MaxIter', 4000);
%and used than:
[x, resnorm] = lsqcurvefit(@FitFunc, p2, f, y, [], [], options);
but it says again the same thing.
Thanks for your help!
Jan

Categories

Asked:

Jan
on 5 Jul 2011

Community Treasure Hunt

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

Start Hunting!