Not enough input arguments

1 次查看(过去 30 天)
I am not understanding what is wrong with line 10, which is [a,b] = size(t);
function [ diffVec ] = GlobChiSq( p, t, Co, Diff, y )
% For loop that creates difference vector that lsqcurvefit uses to optimize
% p
%This equation has four parameters: p1, p2, p3, and p4. p1 is k1 (on rate
%constant), p2 is k2 (off rate constant), p3 is the length of the unstirred
%layer (L), and p4 is iN (total current).
l = 0;
[a,b] = size(t);
for i = 1:a
for j = 1:b
[c,d] = size(concentration);
for k = 1:d
modelFun = p(4) * ((1 - calcPinf(p,t(i,j,k),Co(k),Diff)) * exp(-calcLambda(p,t(i,j,k),Co(k),Diff) * t(i,j,k)) + calcPinf(p,t(i,j,k),Co(k),Diff));
l = l+1;
diffVec(l) = y(i,j) - modelFun(i,j);
end
end
end
end

采纳的回答

Star Strider
Star Strider 2017-4-13
You are calling it as your objective function to lsqcurvefit. The input arguments are specific in all the curve fitting functions.
You need to call it as:
[p,resnorm] = lsqcurvefit(@(p,t) GlobalChiSq( p, t, Co, Diff, y ), startingVals, x, y lb, ub, options)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by