Differential equation to find activation voltage
1 次查看(过去 30 天)
显示 更早的评论
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
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 个评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1514039/image.png)
采纳的回答
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
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1514114/image.png)
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]')
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!