I am trying to fit a set of data to the function V(I) = a*[I + ln(1 + (I / b))] – c but am having some difficulty. MATLAB's 'cftool' was of no help…I also tried using 'lsqnonlin' but was getting some pretty funky results (the fit was not anywhere close to the data).
Anyone know of any possible solutions?
Thank you.
Also, here's the code I was trying to use for the lsqnonlin in case you'd like to view it:
newk0=[1 10 ];newlb=[0 0.2];newub=[100 300 ];for i=1:10 diode2 = @(newk) (k(2)*(ydata(:,i)+log(1+(ydata(:,i)/k(1)))) - xdata); newk(:,i)=lsqnonlin(diode2, newk0, newlb, newub, options);end
where xdata is Voltage and ydata is current. There are 10 sets of data (for different temperatures) which is the reason for the 'for' loop.
Best Answer
If you have the Statistics and Machine Learning Toolbox, then you could use nlinfit.
Here is a simple example of its use: