Problem in defining the fit type function for curve fitting tool
3 visualizzazioni (ultimi 30 giorni)
I have defined a custom function for use in curve fitting toolbox. In my defined function, I need to call another function "kkrebook2" and its inputs are vectors. But for defining a fit type function we have a for loop of our "nu" value and everything is defined in that for loop which means the input for "kkrebook2" will be elements of vector of "nu". So, it doesn't work when I try to fit because it is getting elements instead of vectors.
But I do want to pass a vector of "nu" to "kkrebook2" in my fit type function. Could you please let me know how can I write my fit type function such that I can call "kkrebook2" in my fit type function properly?
This is related part of my code for the defined fit type function for curve fitting and the "kkrebook2" function.
Thank you in advance!
function p = SCR(nu,numGaussians,a,sigma)
for i = 1:length(nu)
for k = 1 : numGaussians
b = Start;
b = Start+(24E6 * (k-1));
thisGaussian(i) = a.*exp(-((nu(i)-b).^2)/(2.*(sigma.^2)));
% Add into accumulator array:
gaussEqn1(i) = gaussEqn1(i) + thisGaussian(i);