From: Peter White on
Hello,
My problem is the following. I'm measuring the I V curve for a solar cell. So that, I get 2 arrays (one is V and the other is I).
Now I know that the integral Int(I,V)= cumtrapz(V,I-Io) can be expressed as an algebraic equation : Int2=a*V+b(I-Io)+c(I-Io)*V+d*V²+e*(I-Io)²

To sum up, Int(I,V) is a 3D curve and I want to find out the coefficient a,b,c,d,e that fit this curve thanks to Int2.
I have 100s couple of I and V.

I used the following function:
function out = fincoef(guesses)
V=[blablabla] I=[blablabla] and so on
Coef(1)=guesses(1);
Coef(2)=guesses(2);
Coef(3)=guesses(3);
Coef(4)=guesses(4);
Coef(5)=guesses(5);
Int2= Coef(1).*V+Coef(2).*(It)+Coef(3).*V.*(It)+Coef(4).*V.^2+Coef(5).*(It).^2;
out=sum((Int-Int2).^2);
end
fminsearch('fincoef',[0,0,0,0,0],options)

The problem is that I don't know the starting guessed value so I put 0 but the fitting is bad. I think I am in a local minimum value and I would like to change the range of these guest values but automatically till it will find the perfect ones.

Could anyone help me?

Thanks a lot

Peter