Not enough input arguments

조회 수: 1 (최근 30일)
Kelly McGuire
Kelly McGuire 2017년 4월 12일
답변: Star Strider 2017년 4월 13일
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