\begin{tikzpicture}
\draw (0, 0) to[L, l=\(L_1\)] (0, 4);
\draw (2, 0) to[C, l=\(C_1\), *-*] (2, 4);
\draw (2, 4) to[R, l=\(R_1\), *-*] (4, 4);
\draw (4, 0) to[C, l=\(C_2\), *-*] (4, 4);
\draw (6, 0) to[R, l=\(R_2\), *-] (6, 2);
\draw[fill=black] (6, 2) to[diode, l=\(D_1\), -*] (6, 4);
\draw (8, 0) to[R, n=R3, *-] (8, 2);
\node[right] at (R3.s) {\(R_3\)};
\draw[fill=black] (8, 4) to[diode, l=\(D_2\), *-] (8, 2);
\node[op amp, xscale=-1, yscale=-1] (opamp) at (12, 2) {};
\draw ($(opamp.out) + (-1, 0)$) to[short, *-] (opamp.out);
\draw ($(opamp.out) + (-1, 0)$) -- ($(opamp.out) + (-1, 1.2)$);
\draw ($(opamp.out) + (-1, 0)$) -- ($(opamp.out) + (-1, -1.2)$);
\coordinate (opamp plus) at (opamp.+);
\coordinate (opamp minus) at (opamp.-);
\draw (opamp plus) -- (opamp plus|-(0, 3.2));
\draw ($(opamp.out) + (-1, 1.2)$) to[R, n=R4, -*] (opamp plus|-(0,3.2));
\node[below] at (R4.s) {\(R_4\)};
\draw (opamp minus) -- (opamp minus|-(0, 0.5));
\draw ($(opamp.out) + (-1, -1.2)$) to[R, l=\(R_5\), -*] (opamp minus|-(0, 0.8));
\draw (0, 4) -- (2, 4);
\draw (4, 4) -- (opamp plus|-(0, 4));
\draw (13.2, 4) -- (opamp plus);
\draw (0, 0) -- (9, 0);
\draw (9, 0) to[R, n=R6, ] (opamp minus|-(0, 0));
\node[below] at (R6.s) {\(R_6\)};
\draw (13.2, 0) -- (opamp minus);
\node[ground] at (8, 0);
\end{tikzpicture}
那么有人能帮我把电阻器 R4 和 R5 像图中那样向左移动吗?提前谢谢 :)
答案1
路径组件始终绘制在命令的起点和终点的中间to
。因此,如果您需要一段导线,然后是一个组件,则请准确说明:
\draw (a) -- ++(0.5,0) to[R] (b);
因此,作为教程要点,我将按照以下方式编写电路的运算放大器部分。请注意,只需更改以下代码即可更改电路的外观一个数字— 其余的也会效仿。所以如果你改变,\def\upwardshift{1.0}
你的电路会更高,如果你改变,1.5
你\draw (OA up) -- ++(-1.5,0) ...
的电路会更宽,没有必须触碰任何其他数字或进行周围协调。
大量评论以显示用法。
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}[]
% everything will be relative to the position of the op amp chosen here.
% better use the `noinv input up` option than yscale=-1 so that the power supply
% anchors are not updown!
\node[op amp, xscale=-1, noinv input up](OA) at (0,0) {\ctikzflipx{\texttt{oa1}}};
% let's create the nodes above the op amp + and below op amp -.
% I am defining the shift here to reuse it for the symmetric one.
\def\upwardshift{1.0}
\draw (OA.+) to[short, -*] ++(0, \upwardshift) coordinate(OA up);
\draw (OA.-) to[short, -*] ++(0, -\upwardshift) coordinate(OA down);
% we want the resistor a bit off to the left; I'll mark the cable end position
% to reuse it on the other side. Just change the numbers here if you want
% to adjust positions, the others branches will follow suit.
\draw (OA up) -- ++(-1.5,0) coordinate(tmp) to[R=$R_4$] ++(-2,0) coordinate(r4 left)
% vertical connection in the same path to have a nice joined line, using
% the perpendicular coordinate system: vertically down (r4 left), horizontally (OA down)
-- (r4 left |- OA down)
% the other R
to[R=$R_5$] (tmp |- OA down) -- (OA down);
% connect the op amp output
\draw (OA.out) to[short, -*] (OA.out -| r4 left) coordinate(OA out);
\end{tikzpicture}
\end{document}
现在将向上移位改为,0.75
并将第一个显式连线改为2.5
和:
这种技术使你的电路具有高度的可重复使用性——你可以建立一个丰富的子电路数据库,这些子电路可以轻松重新调整和重复使用。如果你使用显式坐标,你需要更改许多坐标来适应电路。
答案2
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx,tikz, circuitikz}
\usetikzlibrary{calc}
\usepackage[left=2.00cm, right=1.00cm]{geometry}
\begin{document}
\begin{tikzpicture}
\draw
(0, 0) to [L, l=\(L_1\)] (0, 4)
to (2,4);
\draw
(2, 0) to [C, l=\(C_1\), *-*](2,4)
to [R, l=\(R_1\), *-*] (4, 4)
to (8,4);
\draw
(4, 0) to [C, l=\(C_2\), *-*] (4, 4);
\draw
(6, 0) to [R, l=\(R_2\), *-] (6, 2)
to [diode,fill=black, l=\(D_1\), -*](6, 4)
to (8,4) coordinate(d2)
to [diode,fill=black, l=\(D_2\), *-] (8, 2)
to [R, l=\(R_3\), ] (8, 0)coordinate(r3)
to (0,0);
\node[op amp, xscale=-1, yscale=-1] (opamp) at (12, 2) {};
% \draw ($(opamp.out) + (-1.5, 0)$) to[short, *-] (opamp.out);
\draw (opamp.out) to [short,-*] ++(-1.5,0)
to ++(0,1.2)
to[R, l=R4] ++(1.6,0)coordinate[label=](r4)
to(r4)-|(opamp.+)--(opamp.+);
\draw (opamp.out) to [short,-*] ++(-1.5,0)
to ++(0,-1.2)
to[R, l=R5] ++(1.6,0)coordinate[label=](r5)
to(r5)-|(opamp.-)--(opamp.-);
\draw(d2)-|(opamp.+) (r3)-|(opamp.-);
\node[ground] at (8, 0){};
\end{tikzpicture}
\end{document}