Laplace Transform for ODE - RC Circuit
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
Hello guys, 
I am trying to make a laplace transform from a ODE for a simple RC Circuit.
But When try to use the function subs() in order to replace my laplace transfromed variable >>> laplace(q(t), t, s) for Q(s) I don't see any change at all.
I would like to undestand why and How I can fix this.
Thanks for your helping
%For the capacitor 
syms q(t) s
%Charge (C) 
%initial condition in the beginning 
cond_q = q(0) == 0;
%ODE for capacitor in series with resistor 
ode_capacitor = diff(q, t) + P_c*q == Q_c
%Solving ODE
q = dsolve(ode_capacitor, cond_q);
% simplify(q)
% % % Calculate the derivative of 'Charge' - the current(A) 
i_c = diff(q)
limit(i_c, t, 0)
limit(i_c, t, inf)
% 
% %transformada de laplace
laplace(i_c)
a = laplace(ode_capacitor, t, s)
syms Q
a = subs(a, laplace(q, t, s), Q)
댓글 수: 0
채택된 답변
  Paul
      
      
 2021년 3월 25일
        I think that last subs command is getting confused because q is defined as the solution of the ode. I'm not sure why that's a problem (or if I'm even correct about that), but you can get around this by using a different variable name as the solution of dsolve:
syms q(t) Q(s) P_c Q_c
cond_q = q(0) == 0;
ode_capacitor = diff(q(t),t) + P_c*q == Q_c;
qsol(t) = dsolve(ode_capacitor,cond_q);
i_c(t) = diff(qsol(t),t);
I_c(s) = laplace(i_c(t));
% Laplace transform of the ode
E(s) = laplace(ode_capacitor);
E(s) = subs(E(s),laplace(q(t),t,s),Q(s));
E(s) = isolate(E(s),Q(s));
Q(s) = rhs(E(s));
Q(s) = subs(Q(s),q(0),0);
% compare Q(s) with laplace(qsol(t))
[Q(s) simplify(laplace(qsol(t)))]
% verify relationship between charge and current
[s*Q(s) I_c(s)]
ans =
[ Q_c/(s*(P_c + s)), Q_c/(s*(P_c + s))]
ans =
[ Q_c/(P_c + s), Q_c/(P_c + s)]
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
			
	제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



