% ECE 111 Lecture #7 % 3-stage RC filter t = []; y = []; dt = 0.01; V0 = 10; V1 = 0; V2 = 0; V3 = 0; for i=1:1000 dV1 = 3.333*V0 - 6.500*V1 + 2.500*V2; dV2 = 1.250*V1 - 2.500*V2 + 1.000*V3; dV3 = 0.667*V2 - 0.800*V3; V1 = V1 + dV1*dt; V2 = V2 + dV2*dt; V3 = V3 + dV3*dt; y = [y; V1, V2, V3]; end t = [1:1000]' * dt; plot(t,y); xlabel('Time (seconds)'); ylabel('V(t)');