function plot_capacitor(w,h,A,B) % % plot_capacitor(w,h,A,B) plots a capacitor, % using width w and heigth h, % starting at position A and ending at B. % % ON ENTRY: % w width of the capacitor; % h height of the capacitor; % A x and y coordinates of start position; % B x and y coordinates of end position. % % EXAMPLE: % plot_capacitor(0.1,0.4,[1,1],[2,1]) % axis([0 3 0 2]) % x1 = [-1,-w]; y1 = [0,0]; x2 = [-w,-w]; y2 = [-h,h]; x3 = [w,w]; y3 = [-h,h]; x4 = [w,1]; y4 = [0,0]; if (ishold == 0) hold on; end; [xx1,yy1] = coordinate_transformation(x1,y1,A,B); [xx2,yy2] = coordinate_transformation(x2,y2,A,B); [xx3,yy3] = coordinate_transformation(x3,y3,A,B); [xx4,yy4] = coordinate_transformation(x4,y4,A,B); plot(xx1,yy1); plot(xx2,yy2); plot(xx3,yy3); plot(xx4,yy4);