Project Report 204 (2) 3
Project Report 204 (2) 3
Part-A
1) Based on the equivalent circuit: write and rearrange the
system equation to find the unknowns using Least Square
regression (LS curve fitting) analysis. An experiment was
performed using an electrode area of 2 cm2. The recorded
data for the applied voltage (VS) and the resulting current
(I) can be found in the "EC_data.xlsx" file. Notably, the
experiment was conducted at low voltage levels, ensuring
that the current remained within the range of several nano-
amperes. Consequently, the potential drop in the solution
(IRsol) can be disregarded. It's established that μth equals
1.23V for this particular electrochemical system [Hint: how
many unknowns are there?]
Ans: Here, we are using the equation 𝑦 = 𝛼𝑒 𝛽𝑥 where y = I,
x = V, so the equation after substitution: 𝐼 = 𝛼𝑒 𝛽𝑉 , after
linearizing we get: 𝑙𝑛𝐼 = 𝑙𝑛𝛼 + 𝛽𝑉
𝑉𝐴𝐶
After brief calculation we get 𝐼 = 𝐼𝑜 × exp( ) where,
𝑏
VAC = Vs-1.23
1
( )∗(𝑉𝑠−1.23)
So, the equation for best fit curve is: 𝐼 = 𝐼𝑜 × 𝑒 𝑏
1
after linearizing this we get, 𝑙𝑛𝐼 = 𝑙𝑛𝐼𝑜 + 𝑏 ∗ (𝑉𝑠 − 1.23)
2) Find the best fit curve and plot with the data. You should
provide the relevant code and figures.
Ans:
Code:
close all
clear
clc
[data,text,all_cells]=xlsread('EC_data.xlsx');
I= data(2,:);
V = data(1,:);
yi = log(I);
xi = V-1.23;
n =52;
Xi = sum(xi);
Xi2 = sum(xi.^2);
Yi=sum(yi);
XiYi = sum(xi.*yi);
A = [n,Xi;Xi,Xi2;];
b = [Yi;
XiYi;];
x = inv(A)*b
Io = exp(x(1));
b= 1/x(2)
ymodel = Io*exp((1/b)*(V-1.23));
figure(1)
plot(V,I,'r--'); hold on
plot(V,ymodel,'bo');
xlabel('Vs[Volt]');
ylabel('I[A]');
3) It was found from a separate experiment that Rsol = 100Ω. Now,
Tabulate values of A, rsol, J0 and b.
Ans:
Rsol 100Ω
A 2 cm^2
rsol 200 Ω cm^2
Jo 1.51e-21 A/cm^2
b 0.0304 V
4) Find all the relevant error statistics of the regression and comment
on how good the fit is.
Code :
close all
clear
clc
Io = 3.0268e-21;
b = 0.0304;
Vs =2.45;
Rsol = 100;
ea(1,1)=inf;
IL(1,1) = 0;
IU(1,1) = 0.0678;
VAC=linspace(0,0.7,50);
for k =(1:50)
fIU(k)=(Io *exp((Vs-Rsol*IU(k)-1.23)/b))-IU(k);
fIL(k)=(Io*exp((Vs-Rsol*IL(k)-1.23)/b))-IL(k);
Ir(k) =(IU(k)+IL(k))/2;
fIr(k)=(Io*exp((Vs-Rsol*Ir(k)-1.23)/b))-Ir(k);
if(fIL(k)*fIr(k)<0)
IL(k+1)=IL(k);
IU(k+1)=Ir(k);
elseif (fIU(k)*fIr(k)<0)
IL(k+1)=Ir(k);
IU(k+1)=IU(k);
end
if k >1
ea(k)=abs((Ir(k)-Ir(k-1))/Ir(k))*100;
if ea(k) < 10^-8
break;
end
end
end
x = 1:length(ea);
X = 1:length(Ir);
figure(1)
plot(X,Ir,'b-O');
xlabel('iterations');
ylabel('Iest[A]');
figure(2)
semilogy(x,ea,'b-o')
xlabel('iterations');
ylabel('error[%]');
7) Write a function which takes in the applied voltage and gives
the value of I where user inputs (A,rsol,Io,b,Vs) to get the output
I and also name the function as EC_system.
Ans:
8) Now for various source voltages (𝑉𝑆) ranging between 1.8V
to 6V (take at least 150 points), use the function to find the
values of 𝐼. Do the following:
figure(3)
plot(Vs,CH2,'r-o');
xlabel('Vs[V]');
ylabel('CH2[5USD/kg]');
figure(4)
plot(Vs,C,'r-o');
xlabel('Vs[V]');
ylabel('economic gain');