"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <hvr7rh$nqs$1@fred.mathworks.com>...
> "Ryan Need" <rneed@clemson.edu> wrote in message <hvr364$e4l$1@fred.mathworks.com>...
> Hi,
> Could you supply measured V and I vectors and displayed error messages?
> Mira
Sorry to hijack this thread
but i am on the same problem where i have to fit data i have with a solar cell model
i have 2 sets of data v and i, 904 points each
currently they are set up as column vectors
i have set up 3 functions to achieve the fitting
initeval, which is used to calculate isat and isc
diodemodel, which takes the two outputs from the above function and houses my main equation
function F = diodemodel(x,i,v)
K = 1.38e23;
T = 298.15; %25 degrees in Kelvin
q = 1.6e19;
[isat,isc] = initeval;
N=x(1);
RSH=x(2);
F = iscisat*(exp(q*(v+5*i)/N*K*T)1)((v+5*i)/RSH)i;
lastly i have the solving function, diodesolve
vi = xlsread('vi.xls');
i = vi(:,2);
v = vi(:,1);
init = [1 100000];
options = optimset('Largescale','off')
x=lsqnonlin(@diodemodel,init,[],[],options,i,v);
when i run this, the error message i got is:
Local minimum possible.
lsqnonlin stopped because the relative size of the current step is less than
the default value of the step size tolerance.
the purpose of my code is to use initeval to calculate the initial variables
diodemodel is where the model sits
diodesolver is to use lsqnonlin to solve the model and fit the data
i am just wondering :
have i coded this correctly?
what can i do to make it work if the concept is correct?
Any help will be appreciated,
Sam
