Differential equation to find activation voltage

1 view (last 30 days)
I am trying to calculate the activation voltage, with the following code:
i = 100 ;
t = [0 0.2 0.01];
R = 8.314;
G = 9.648*10^4;
T = 303.15; %Conductivity reference temperature
i_0dob = 0.67;
A_m = 232e-4;
b_ca = 0.55 ;
b_an = 1-b_ca ;
C_dl = 3.15e-2*A_m ;
syms u(t)
ode = diff(u,t) == (i-A_m * i_0dob * (exp(((b_an*G)/(R*T))*u)-exp((-(b_ca*G)/(R*T))*u)))/C_dl;
cond = u(0) == 0;
uSol(t) = dsolve(ode,cond) %This - is line 19
Warning: Unable to find symbolic solution.
uSol(t) = [ empty sym ]
I get the warning:
Warning: Unable to find symbolic solution
In dsolve (line 209) %i dont have a line 209??
In Problem43 (line 19)
Can anybody help?
  3 Comments
Sam Chak
Sam Chak on 18 Oct 2023
Could you also take a screenshot of the parameters and post it here super quickly? In the problem image, the values of the parameters are not displayed. It would be helpful for us to cross-check because selected values often impact the transient behavior of the system.

Sign in to comment.

Accepted Answer

Torsten
Torsten on 17 Oct 2023
Edited: Torsten on 17 Oct 2023
Matlab cannot find an analytical expression for u. You have to use a numerical approach.
I'm not sure about the term exp(b_an*G/(R*T)*u). Shouldn't it be exp(-b_an*G/(R*T)*u) ?
i = 100 ;
R = 8.314;
G = 9.648*10^4;
T = 303.15; %Conductivity reference temperature
i_0dob = 0.67;
A_m = 232e-4;
b_ca = 0.55 ;
b_an = 1-b_ca ;
C_dl = 3.15e-2*A_m ;
fun= @(t,u) (i-A_m * i_0dob * (exp(b_an*G/(R*T)*u)-exp(-b_ca*G/(R*T)*u)))/C_dl;
tspan = [0 0.01];
u0 = 0;
[T,U] = ode15s(fun,tspan,u0);
plot(T,U)
  11 Comments
Sam Chak
Sam Chak on 18 Oct 2023
I believe I've found the typo in C_dl. However, I'm struggling to plot the piecewise current i and using an anonymous function. Maybe I should ask @Torsten for help.
i = [100, 10, 100];
t = [0, 0.2, 0.4, 0.5];
R = 8.314; % looks like gas constant (does gas mix with electric?)
G = 9.648e4;
Temp = 303.15; % Conductivity reference temperature
i_0dob = 0.67;
A_m = 232e-4;
b_ca = 0.55;
b_an = 1 - b_ca;
C_dl = (3.15e2)*A_m; % affect the transient
T = [];
U = [];
u0 = 0;
for j = 1:numel(i)
fun = @(t,u) (i(j) - A_m*i_0dob*(exp(b_an*G/(R*Temp)*u) - exp(- b_ca*G/(R*Temp)*u)))/C_dl;
tspan = [t(j) t(j+1)];
[Tstep,Ustep] = ode15s(fun, tspan, u0);
T = [T; Tstep];
U = [U; Ustep];
u0 = Ustep(end,:);
end
% Plot Voltage
subplot(211)
plot(T, U, 'linewidth', 1.5), grid on
xlabel('t, [s]')
ylabel('u, [V]')
% Plot Currents
im = A_m*i_0dob*(exp(b_an*G/(R*Temp)*U) - exp(- b_ca*G/(R*Temp)*U));
% i =
% id = i - im;
subplot(212)
plot(T, im, 'r'), grid on, ylim([-100 100])
xlabel('t, [s]')
ylabel('i, [A]')
Anniken
Anniken on 18 Oct 2023
Yes!Had typo in C_dl and the G and F.... The bug was fixed and also a function was implemented and the resolution was found! Thank you so much for all the help:D

Sign in to comment.

More Answers (0)

Categories

Find more on Chemistry in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!