Differential equation to find activation voltage

2 Ansichten (letzte 30 Tage)
Anniken
Anniken am 17 Okt. 2023
Kommentiert: Anniken am 18 Okt. 2023
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 Kommentare
Anniken
Anniken am 18 Okt. 2023
Yes! Its this one!
Sam Chak
Sam Chak am 18 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 17 Okt. 2023
Bearbeitet: Torsten am 17 Okt. 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 Kommentare
Sam Chak
Sam Chak am 18 Okt. 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 am 18 Okt. 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Chemistry finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by