I would do something like this —
Data = [(0:10).' rand(11, 3)]; % Data = [Time Current Voltage Temperature
SOC = rand(11,1);
fcn = @(E0, r, k0, k1, k2, k3, Iin, Vm, SOC) E0 + Iin.*r - k0./SOC - k1.*SOC + k2.*log(SOC) + k3.*log(1-SOC) - Vm;
objfcn = @(b) norm(fcn(b(1),b(2),b(3),b(4),b(5),b(6),Data(:,2),Data(:,3),SOC));
B0 = rand(1,6);
Parms = fminunc(objfcn, B0)
fprintf(1,'E0 = %6.3f\nr = %6.3f\nk0 = %6.3f\nk1 = %6.3f\nk2 = %6.3f\nk3 = %6.3f\n',Parms)
Make appropriate changes for your data.
.