Error in lsqcurvefit (line 225)
4 views (last 30 days)
Show older comments
I am absolutely new to the matlab.
i have 2 vectors,
xdata is 744x1 double
ydata is 744x1 double
my function is
function ydata=calcor(k,xdata)
ydata=(1-(1-k)*(xdata.^k));
end
i am trying to get k
k= lsqcurvefit(@calcor,[0 0],xdata,ydata)
it giving me error:
Error using .^
Matrix dimensions must agree.
Error in calcor (line 2)
ydata=(1-(1-k)*(xdata.^k));
Error in lsqcurvefit (line 225)
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});
Caused by:
Failure in initial objective function evaluation. LSQCURVEFIT cannot continue.
whats is wrong with the code
1 Comment
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!