The time in the graph is resulting in omore than it should take to charge.
Trying to solve time of charge of supercapacitor with ode45
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Isaac Husny T
le 29 Avr 2020
Commenté : David Goodmanson
le 1 Mai 2020
fprintf(' Modelación del Supercapacitor');
%Inputs
R1=100;%Ohms
R2=100;%Ohms
RC=1000;%Ohms
C1=.00001;%Farads
C2=.0001;%Farads
DV=5;%Voltios
%Pasar a valores para sacar raices
A=(RC+R1)*R2*C1;
B=(RC+R1)*(C1/C2)+R2;
C=1;
%Eliminar raÌces imaginarias
%fg=@(t,x)[x(2);(DV-B*x(2)-C*x(1))/A];
fg=@(t,x) [x(1);(DV-B*x(1)-C*x(2))/A];
tf = 5;
%Polinomio
%p=[A,B,C];
%rp=roots(p);
%rmin=min(abs(rp));
Dt=[0,tf];%De donde a donde queremos graficar
X0=[0,0];%Condiciones iniciales
[t,x]=ode45(fg,Dt,X0);
plot(t,x(:,2));
xlabel('Tiempo (Segundos)');
ylabel('Voltaje (Volts)');
5 commentaires
Réponse acceptée
David Goodmanson
le 29 Avr 2020
Hello Isaac
It seems easier to do this as two first order equations for the node voltages V1 and V2 rather than go to a second order differential equation for one of them.
[t V] = ode45(@vdot,[0 1],[0 0])
figure(2)
plot(t,V);grid on
function dVdt = vdot(t,V)
Rc = 1000;
R1 = 100;
R2 = 100;
Rs = Rc + R1;
C1 = 10e-6;
C2 = 100e-6;
E = 5;
i2= (V(1)-V(2))/R2;
i1 = (E - V(1))/Rs - i2;
dVdt = [i1/C1; i2/C2];
end
This calculation does show a time constant on the order of .1 sec.
4 commentaires
David Goodmanson
le 1 Mai 2020
Hi Isaac,
I understand that in course work you sometimes required to use certain methods for learning purposes. However, in this case since a much superior method is available, I'm not keen to work out the result for a second order ODE in one variable. Especially since it's complicated and only gives you one voltage, whereas the pair of first order ODEs as used above gives you both. But if you need to do it, here is an outline where the R and C constants are not carried along explicitly (keeping track of those is the hard part). I'm guessing the voltage across C2 is the one of interest.
[1] from the second comment, plug the top two eqns into the bottom two to obtain**
V2dot ~ V1,V2 (a)
V1dot + V2dot ~ E,V1 (b)
[2] differentiate (a) to obtain
V2dotdot ~ V2dot,V1dot (c)
[3] eliminate V1 from (a) and (b) to obtain
V1dot ~ V2dot,V2,E (d)
[4] plug (d) into (c) to obtain
V2dotdot ~ V2dot,V2,E (e), a second order ODE for V2
** in these equations, the right hand side is a linear combination
of the variables shown.
With standard ode solvers using sets of first order ODEs it seems quixotic to have to go to a second order ODE, but if my grade depended on it I suppose I would do it too.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Phase-Locked Loops dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!