Dear Matlab users, I am having a problem to fit my experimental data to a given equation. I have to calculate the R^2 value for that fit.

% My initial values:

Isc = 0.45; Voc = 9.54/16; Is = 10^-8; Vr = (298*1.32*10^-23)/(1.6*10^-19); N = 16; rm = 1.33

My model Eq : Im = Isc – Is.*(exp(Vm./(rm*Vr*N)) – 1)

Experimental Values:

V = [0.05, 0.49, 0.89, 2.07, 3.71, 4.51, 5.49, 6.61, 6.9, 7.64, 7.85, … 8.35, 8.55, 8.6, 8.61, 8.63, 8.67, 8.7, 8.75, 8.77, 8.81, 8.82, … 8.83, 8.85, 8.87, 8.89, 8.9];

I = [0.42, 0.42, 0.41, 0.41, 0.4, 0.4, 0.4, 0.41, 0.41, 0.4, 0.4, 0.4, … 0.39, 0.38, 0.38, 0.37, 0.36, 0.35, 0.33, 0.31, 0.3, 0.29, 0.28, … 0.26, 0.25, 0.24, 0.22];

I want to plot V vs I graph first and then on the same graph plot the model equation. Then I want to find the R^2 value for that fitting.

Can someone help me please??

Thanks.

## Best Answer