Error: Function value and YDATA sizes are not equal
Show older comments
I have a fitting code with lsqcurvefit function. I am having this error "Function value and YDATA sizes are not equal"(line 251). Please give your suggestion to solve it.
clear all, close all, clc
EQE = xlsread('EQERollOff','Sheet1','A30:B55');% loading raw data from excel file
x = EQE(:,1);% Current
y = EQE(:,2);% EQE
%parameter estimation
J0 = [6];
options = optimset('Algorithm', 'trust-region-reflective');
[J,Rsdnrm,Rsd,ExFlg,OptmInfo,Lmda,Jmat] = lsqcurvefit(@EQEFit,J0,x,y)
function s = EQEFit(J,x)% function for fitting
s = J(1)/(4*x)*(sqrt(1+8*(x/J(1)))-1)*5
end
Size of x = 26 1, Size of y = 26 1
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!