Differential equation to find activation voltage

조회 수: 1 (최근 30일)
Anniken
Anniken 2023년 10월 17일
댓글: Anniken 2023년 10월 18일
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
Anniken
Anniken 2023년 10월 18일
Yes! Its this one!
Sam Chak
Sam Chak 2023년 10월 18일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2023년 10월 17일
편집: Torsten 2023년 10월 17일
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
Sam Chak
Sam Chak 2023년 10월 18일
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 2023년 10월 18일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Chemistry에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by