% This script plots a general circuit with % inductance L, resistor R, capacitor C, and switch S. hold on % plotting the frame of the circuit: plot_line([0,0],[1,0]); plot_line([2,0],[3,0]); plot_line([0,3],[1,3]); plot_line([2,3],[3,3]); plot_line([0,0],[0,1]); plot_line([0,2],[0,3]); plot_line([3,0],[3,1]); plot_line([3,2],[3,3]); % plotting switch, capacitor, inductor, resistor plot_switch(0.6,1.2,[1,0],[2,0]); plot_capacitor(0.1,0.4,[0,1],[0,2]) plot_inductor(5,0.4,[1,3],[2,3]) plot_resistor(5,0.4,[3,1],[3,2]) % put the marking labels text(1.5,3.5,'L'); text(3.5,1.5,'R'); text(1.5,-0.5,'S'); text(-0.5,1.5,'C'); title('circuit with inductance L, resistor R, capacitor C, and switch S'); % final axis axis([-1 4 -1 4]) hold off