Effacer les filtres
Effacer les filtres

Not enough input arguments

1 vue (au cours des 30 derniers jours)
Kelly McGuire
Kelly McGuire le 12 Avr 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

Réponse acceptée

Star Strider
Star Strider le 13 Avr 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)

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by