Error using fit>iFit Too many start points. You need 2 start points for this model
Dear all
I have created this function to do implement a fitting to some data:
function [fitresult,gof]=Fit(s,mag,in_mag,in_cond)
if round(in_mag(1))==1 && round(in_mag(end))==-1
fitting_function=’cos(2*atan(exp((x-x0)/Delta)))’;
elseif round(in_mag(1))==-1 && round(in_mag(end))==1
fitting_function=’cos(2*atan(exp(-(x-x0)/Delta)))’;
end
ft=fittype(fitting_function,’independent’,’x’,’dependent’,’y’);
opts=fitoptions(‘Method’,’NonlinearLeastSquares’);
opts.Display=’Off’;
opts.StartPoint=in_cond;
[fitresult,gof]=fit(space,mag,ft,opts);
When trying to fit some data:
initial_conditions=[1 1];
[fitresult,gof]=Fit(some_column_vector,other_column_vector,another_column_vector,initial_conditions’);
where "some_column_vector", "other_column_vector", and "another_column_vector" are 1000×1 arrays.
I received the following error:
Error using fit>iFit
Too many start points. You need 2 start points for this model.
Any ideas on what could be happening here?Dear all
I have created this function to do implement a fitting to some data:
function [fitresult,gof]=Fit(s,mag,in_mag,in_cond)
if round(in_mag(1))==1 && round(in_mag(end))==-1
fitting_function=’cos(2*atan(exp((x-x0)/Delta)))’;
elseif round(in_mag(1))==-1 && round(in_mag(end))==1
fitting_function=’cos(2*atan(exp(-(x-x0)/Delta)))’;
end
ft=fittype(fitting_function,’independent’,’x’,’dependent’,’y’);
opts=fitoptions(‘Method’,’NonlinearLeastSquares’);
opts.Display=’Off’;
opts.StartPoint=in_cond;
[fitresult,gof]=fit(space,mag,ft,opts);
When trying to fit some data:
initial_conditions=[1 1];
[fitresult,gof]=Fit(some_column_vector,other_column_vector,another_column_vector,initial_conditions’);
where "some_column_vector", "other_column_vector", and "another_column_vector" are 1000×1 arrays.
I received the following error:
Error using fit>iFit
Too many start points. You need 2 start points for this model.
Any ideas on what could be happening here? Dear all
I have created this function to do implement a fitting to some data:
function [fitresult,gof]=Fit(s,mag,in_mag,in_cond)
if round(in_mag(1))==1 && round(in_mag(end))==-1
fitting_function=’cos(2*atan(exp((x-x0)/Delta)))’;
elseif round(in_mag(1))==-1 && round(in_mag(end))==1
fitting_function=’cos(2*atan(exp(-(x-x0)/Delta)))’;
end
ft=fittype(fitting_function,’independent’,’x’,’dependent’,’y’);
opts=fitoptions(‘Method’,’NonlinearLeastSquares’);
opts.Display=’Off’;
opts.StartPoint=in_cond;
[fitresult,gof]=fit(space,mag,ft,opts);
When trying to fit some data:
initial_conditions=[1 1];
[fitresult,gof]=Fit(some_column_vector,other_column_vector,another_column_vector,initial_conditions’);
where "some_column_vector", "other_column_vector", and "another_column_vector" are 1000×1 arrays.
I received the following error:
Error using fit>iFit
Too many start points. You need 2 start points for this model.
Any ideas on what could be happening here? fitting MATLAB Answers — New Questions