我目前正在尝试制作这个电路,但每次我做任何事情它都会发出噪音。我想要添加的是红色的。
以下是代码和结果
\begin{document}
\begin{circuitikz}
\node[op amp, noinv input up] at (0,0) (opamp) {};
\node[ground] at (-4.69,-5.5) (ground) {};
\draw (opamp.-) -- ++(-1.15,0) -- ++(0,-2) to[R, l_=$R_1$] ++(0,-2.5) to[short,-*] ++(-2.35,0);
\draw (opamp.+)(-3,0)to[R, l_=$R_1$] -- ++(-3.5,0) to[V, l_=$v_\text{IN}$,] ++(0,-3) -- (ground);
\draw (1.66,0) to[short,*-] ++(0,-2.5) to[R, l^=$R_2$, -*] ++(-4,0);
\draw (opamp.out) to[short,-*] ++(1.5,0) node[shift={(0.6,0)}] {$v_\text{O}$};
\draw[-latex] (opamp.up) -- ++(0,0.5) node[above] {$V_+$};
\draw[-latex] (opamp.down) -- ++(0,-0.5) node[below] {$V_-$};
\node[shift={(0,-0.3)}] at (opamp.-) {\scriptsize$v_-$};
\node[shift={(0,+0.3)}] at (opamp.+) {\scriptsize$v_+$};
\end{circuitikz}
\end{document}
答案1
您的主要错误是忽略了从 LaTeX 收到的错误:
wth.tex|8 error| Package tikz Error: (, +, coordinate, pic, or node expected.
wth.tex|8 error| Package pgf Error: No shape named `' is known.
...
与 LaTeX 几乎总是一样,只有第一个错误才是真正相关的,其他错误可能仅与试图忽略发现的错误而产生的误解有关。
有问题的行是
\draw (opamp.+)(-3,0)to[R, l_=$R_1$] -- ++(-3.5,0) [...]
错误很明显:您需要在 a 之后有一个节点/坐标,to
但是您有一个--
。
将该行更改为
\draw (opamp.+) to[R, l_=$R_1$] ++(-3.5,0) to[V, l_=$v_\text{IN}$,] ++(0,-3) -- (ground);
你有:
现在,作为由@Jasper Habicht 建议,您可以通过向生成器添加名称并使用方法如下。
完整示例如下:
\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}[]
\node[op amp, noinv input up] at (0,0) (opamp) {};
\node[ground] at (-4.69,-5.5) (ground) {};
\draw (opamp.-) -- ++(-1.15,0) -- ++(0,-2) to[R, l_=$R_1$] ++(0,-2.5) to[short,-*] ++(-2.35,0);
\draw (opamp.+) to[R, l_=$R_1$] ++(-3.5,0) to[V, l_=$v_\text{IN}$, name=myV] ++(0,-3) -- (ground);
\draw (1.66,0) to[short,*-] ++(0,-2.5) to[R, l^=$R_2$, -*] ++(-4,0);
\draw (opamp.out) to[short,-*] ++(1.5,0) node[shift={(0.6,0)}] {$v_\text{O}$};
\draw[-latex] (opamp.up) -- ++(0,0.5) node[above] {$V_+$};
\draw[-latex] (opamp.down) -- ++(0,-0.5) node[below] {$V_-$};
\node[shift={(0,-0.3)}] at (opamp.-) {\scriptsize$v_-$};
\node[shift={(0,+0.3)}] at (opamp.+) {\scriptsize$v_+$};
\ctikztunablearrow{1}{1.25}{150}{myV}
\end{tikzpicture}
\end{document}
导致
PS:(看到了吗?现在答案更有用了,因为你知道错误来自哪里!而且你有一个“最小工作示例”,你应该随时将其添加到你的问题中)
答案2
除了带有电源电压的运算放大器外,该方案写在一个\draw
循环中:
\documentclass[margin=3mm]{standalone}
\usepackage{amsmath}
\DeclareMathOperator{\IN}{\textsc{in}}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[american]
\node[op amp, noinv input up] (oa) {};
\draw[-stealth] (oa.up) -- ++ (0,+0.5) node[above] {$V_{+}$};
\draw[-stealth] (oa.down) -- ++ (0,-0.5) node[below] {$V_{-}$};
\draw
(oa.-) node[below] {\scriptsize $v_-$}
-| ++ (-0.5,-1.5) coordinate (aux)
to [R, a=$R_1$, *-] ++ (0,-2)
to [short,-*] ++ (-3,0) node (gnd) [ground] {}
to [V=$V_{\IN}$, name=V] (gnd |- oa.+) %
to [R=$R_1$] ++ (3,0) -- (oa.+)
node[above] {\scriptsize $v_+$}
(oa.out) to [short,] (oa.out |- aux)
to [R=$R_2$] (aux)
(oa.out) to [short, -o] ++ (0.5,0) node[right] {$v_o$}
;
\ctikztunablearrow[thick]{1}{1.2}{-30}{V}
\end{circuitikz}
\end{document}