I used fsolve function (advised by Mischa Kim) to solve the diode equation and it worked (with small modification on (q/nkT).
fun = @(I) Il - Io * exp((V + I*R)/(n*kT_q)) - (V + I*R)/S - I;
Now I need to do a fitting using the same equation but this time I need Matlab to iterate the values for:
Il , Io, R, n, S,
in order to solve I which will give me the best fit against the experimental I (Iexp) where V is the independent variable. I guess I will need the least square function for that but first how do I ask Matlab to do the iteration and eventually solve the I?
Thank you very much for your help.
Rosemarie