function RLC clc; clear all; close all; R=100; L=0.047; C=0.0000001; V=10; tspan=1000; h=0.000001; N=tspan/h; y=zeros(0,10); t=zeros(1,10); y(1,1)= 0; y(2,1)= 10; for i=1:9999 t(i+1)= t(i) + h; y(:,i+1) = y(:,i) + h*sys2(t(i),y(:,i)); end plot(t,y(1,:)) grid on function dydt=sys2(t,y) dydt(1)= y(2); dydt(2)= -(R/L)*dydt(1) - (1/(L*C))*y(1) + (1/(L*C))*V; dydt=[dydt(1);dydt(2)]; end end