function plot_resistor(n,w,A,B) % % plot_resistor(n,w,A,B) plots a resistor, % starting at position A and ending at B. % % ON ENTRY: % n number of turns minus 1 in the resistor; % w width of the resistor, amplitude; % A x and y coordinates of start position; % B x and y coordinates of end position; % % EXAMPLE: % plot_resistor(5,0.4,[1,1],[2,1]) % axis([0 3 0 2]) % Dx = 1/(2*n); x = [-1+Dx:2*Dx:1]; [m1,n1] = size(1:length(x)); y = w*[0, (-ones(1,n1-2)).^(1:n1-2), 0]; x = [-1,x,1]; y = [0,y,0]; [xx,yy] = coordinate_transformation(x,y,A,B); plot(xx,yy);