Can I use lsqcurvefit for a function of multiple variables?
Afficher commentaires plus anciens
Here is the code I am trying to run:
coeff0 = [1 0.5 2];
svData(:,1) = varStruct(indVar).sv1vals'
svData(:,2) = varStruct(indVar).sv2vals'
zData = varStruct(indVar).linearB'
b = lsqcurvefit(klaCorr,coeff0,svData,zData);
The function klaCorr, which I have in a separate function m-file:
function klaX = klaCorr(coeff,sv)
klaX = coeff(1) + (sv(1)^coeff(2))*(sv(2)^coeff(3));
end
And the output:
svData =
248.8431 1.7500
400.4011 1.7500
400.4011 2.0000
103.7757 1.7500
103.7757 1.7500
103.7757 1.7500
zData =
1.0e-04 *
0.0637
0.1115
0.1272
0.0468
0.0504
0.0321
Not enough input arguments.
Error in klaCorr (line 2)
klaX = coeff(1) + (sv(1)^coeff(2))*(sv(2)^coeff(3));
Error in klascripts (line 609)
b = lsqcurvefit(klaCorr,coeff0,svData,zData);
Does anyone know why I am getting this error message?
Also, if there is a better way to do this with a function other than lsqcurvefit, I am open to suggestions!
Feel free to ask for more details :)
Thanks
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Geometry and Mesh dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!