clear clc close all syms t i(t) = piecewise( t<=2e-3, -2e-3, ... t>2e-3 & t<=10e-3, t-4e-3, ... t>10e-3 & t<=12e-3, -t+16e-3, ... t>12e-3, 4e-3); cinicial = 16e-6; q(t) = int(i(t),t,0,t) + cinicial; fplot(q(t),[0 16e-3],'r',"LineWidth",1.5) grid on grid minor title('Carga eléctrica') ylabel('q [C]') xlabel('t [s]') %Verificación de gráfica de corriente i1(t)= diff(q(t)); fplot(i1(t),[0 16e-3],'b',"LineWidth",5) hold on fplot(i(t),[0 16e-3],'r',"LineWidth",2) set(gca,'Ylim',[-3e-3 7e-3]) grid on grid minor title('Corriente eléctrica') ylabel('i [A]') xlabel('t [s]')