Filter löschen
Filter löschen

Not enough input arguments

1 Ansicht (letzte 30 Tage)
Kelly McGuire
Kelly McGuire am 12 Apr. 2017
Beantwortet: Star Strider am 13 Apr. 2017
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

Akzeptierte Antwort

Star Strider
Star Strider am 13 Apr. 2017
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)

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by