我使用“电路声明符号”为电压和电流噪声源编写了代码。该选项对噪声电压很有效。我可以更改字体颜色、周长和图案,因为它们都基于原始图形“圆 ee”。但我对电流噪声源有疑问,我创建了一个“快捷方式”,但解决方案并不优雅。因为,当我改变电路的尺寸时,一切都会失败。我想我需要一个新的符号,但我不知道如何构造它。电路的参考是 INop 源。
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{color}
\usepackage{colortbl}
\usepackage{graphicx}
\usepackage[european]{circuitikz}
\usepackage{siunitx}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{patterns}
\usetikzlibrary{circuits}
\usetikzlibrary{circuits.ee}
\usetikzlibrary{circuits.ee.IEC}
\begin{document}
\begin{center}
%\fbox{
\begin{tikzpicture} [
circuit ee IEC,
x=1.2cm,y=0.9cm,
every info/.style={font=\tiny},
font=\scriptsize,
small circuit symbols,
circuit declare symbol=sR,
set sR graphic={fill=white,draw,shape=circle,minimum size=5mm
}
]
%--------------------------------------------------------------------Circuit
% Contact Nodes
\foreach \contact/\x in {1/2,2/4}
{
\node [contact] (L1P\contact) at (\x,0) {}; %L1Px Line 1 Contact Point \x
\node [contact] (L2P\contact) at (\x,3) {}; %L1Px Line 1 Contact Point \x
}
\draw (5.5,1.5) node [op amp, thick,scale=1] (opamp) {};
\draw (L1P1) node[rground, scale=1] {};
\draw (0,3) to [sV=$Us_i$] (0,0);
\draw (0,0) -- (2,0);
\draw (0,3) to [
black, sR={black,near start,info={$U_{NRi}$},
pattern=north west lines,pattern color = black!80,scale=1},
resistor={near end,info=$R_i$,scale=0.9}
] (L2P1);
\draw (L2P1) to [
resistor={near start,info=$R_1$,scale=0.9},
black, sR={black,near end,
info=left:{$U_{NR_1}$},pattern=north west lines,
pattern color = black!80,scale=1}
] (L1P1);
\draw (L1P1) to [
resistor={near start,info=$R_2$,scale=0.9},
black, sR={near end,info={$U_{NR_2}$},
pattern=north west lines,pattern color = black!80,scale=1}
] (L1P2);
% ----------------------------------------One possibility for the Noise Source.
% Here my version of the Symbol, but I found very ineffective. Very manual.
\path (L1P2) to [black,sR={black,
pattern=north west lines,pattern color = blue!80}] (4,2.55);
\path (4,0.45) to [black, sR={black,
info=left:{\tiny$I_{Nop}$},pattern=north west lines,
pattern color = blue!80}] (L2P2);
\draw (L1P2) -- (4,1.04); %Disadvantage
\draw (L2P2) -- (4,1.96); %Disadvantage
%--------------------------------------------------------------
\draw (L2P2) to [
black,sR={black,info={$U_{Nop}$},pattern=north west lines,pattern color = black}
] (L2P1);
\draw (L2P2) -- (4.5,3) -- (opamp.-);
\draw (L1P2) -- (4.5,0) -- (opamp.+) (opamp.out) node [ right ] {$Us_{o}$};
%-------------------------------------------------Ende der Schaltung
\end{tikzpicture}%}
\end{center}
\end{document}
答案1
我找到了一个使用几何概念的解决方案,但代码有点大。我想生成类似函数的东西,任何帮助。这是代码。你只需要两个点,代码就会绘制噪声电流源。第一个坐标始终是左上方的点。
\documentclass{article}
\usepackage{german, ngerman}
\usepackage[ngerman]{babel}
\usepackage{selinput}
\SelectInputMappings{
germandbls={ß},}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usepackage{tkzexample}
\usepackage{pgfplots}
\usepackage{color}
\usepackage{colortbl}
\usepackage{graphicx}
\usepackage[european]{circuitikz}
\usepackage{siunitx}
\usetikzlibrary{intersections}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{patterns}
\usetikzlibrary{circuits}
\usetikzlibrary{circuits.ee}
\usetikzlibrary{circuits.ee.IEC}
\usetikzlibrary{shapes,snakes} %New Library
\setlength\parindent{0pt}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[h]
\begin{center}
\begin{tikzpicture} [
circuit ee IEC,
x=1cm,y=2cm,
every info/.style={font=\tiny},
font=\scriptsize,
small circuit symbols,
circuit declare symbol=sR,
set sR graphic={fill=white,draw,shape=circle,minimum size=5mm}
]
%---------------------------------------------------------------Contact Points
% Contact Nodes
\foreach \contact/\x in {1/1}
{
\node [contact] (L1P\contact) at (\x,0) {}; %L1Px Line 1 Contact Point \x
\node [contact] (L2P\contact) at (\x,3) {}; %L1Px Line 1 Contact Point \x
}
\draw (L1P1) node[rground, scale=1] {};
%%%%%%%% Probando sin Funcion Codigo Final %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------------------------------------- Drawing the Stromrauschquelle
%--------------------------------------------------Coordinate Calculations
\coordinate (A) at (L2P1);
\coordinate (B) at (L1P1);
\coordinate (C) at ($(A)!0.5!B)$);
\node [name path = Circle,opacity=0][sR,scale=2] (P) at (C) {};
%-------------------------------------------------Intersection Calculations
\path [name path=Line] (A)--(B);
\path [name intersections={of=Line and Circle}];
\coordinate (D) at (intersection-1);
\coordinate (E) at (intersection-2);
% Calculating the new centers of the circles.
\coordinate (F) at ($(D) !0.30!(C)$);
\coordinate (G) at ($(C) !0.70!(E)$);
% Calculating Radio of the circles based on the original circle.
\draw let \p1 = ($(D)-(C)$),
\n0={veclen(\x1,\y1)}
in
node[draw,name path = Circle1,circle,minimum size = 2*\n0,
pattern=north west lines,pattern color = blue!80] (P1) at (F) {}
node[draw,name path = Circle2,circle,minimum size = 2*\n0,
pattern=north west lines,pattern color = blue!80] (P2) at (G) {};
% Two Path Lines pro calculate the intersection H and I for the lines.
% This is needed because our figure can rotate.
\draw [name path = Line1, draw=none] (A) -- (D);
\draw [name path = Line2, draw=none] (B) -- (E);
\path [name intersections={of=Line1 and Circle1}];
\coordinate (H) at (intersection-1);
\path [name intersections={of=Line2 and Circle2}];
\coordinate (I) at (intersection-1);
% Now we can choose which line would we want for the lines between A-H and B-I
\draw (A) -- (H);
\draw (B) -- (I);
\end{tikzpicture}
\end{center}
\caption{Stromquelle Stufe 1}
\label{Fig:IN01}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}