1

Good Evenning, I want draw this graph that has 2 graph, I use the tikzpicture package and axis.

A graph is a signal input(left), and anotar is signal output (below).

I want replicate this graph.enter image description here And just I did this graphic, the blue point is a point operation. enter image description here

This is my code.

\begin{tikzpicture}
    \begin{axis}[axis lines= middle, xlabel={$V[v]$}, ylabel={$I$}, xlabel style={above right},ylabel style={above left}, xmin= 0, xmax = 10, ymin=0, ymax = 0.001, y post scale = 1.5]
      \addplot[domain= 0:10, samples = 100, thick,green] {((-0.0001)*x)+0.001)};
      \addplot[red, mark=*, only marks] coordinates{(0.1,0)};
      \addplot[red, mark=*, only marks] coordinates{(0.19,0.000001)};
      \addplot[red, mark=*, only marks] coordinates{(0.29,0.000001)};
      \addplot[red, mark=*, only marks] coordinates{(0.36,0.000004)};
      \addplot[red, mark=*, only marks] coordinates{(0.40,0.00001)};
      \addplot[red, mark=*, only marks] coordinates{(0.40,0.00002)};
      \addplot[red, mark=*, only marks] coordinates{(0.45,0.000025)};
      \addplot[red, mark=*, only marks] coordinates{(0.46,0.000034)};
      \addplot[red, mark=*, only marks] coordinates{(0.45,0.000045)};
      \addplot[red, mark=*, only marks] coordinates{(0.48,0.000052)};
      \addplot[red, mark=*, only marks] coordinates{(0.50,0.00015)};
      \addplot[red, mark=*, only marks] coordinates{(0.50,0.00025)};
      \addplot[red, mark=*, only marks] coordinates{(0.57,0.00034)};
      \addplot[blue, mark=*, only marks] coordinates{(0.60,0.00094)};
      \draw (axis cs: 0.1,0) circle [radius=1];
      \draw (axis cs: 0.19,0.000001) circle [radius=1];
      \draw (axis cs: 0.29,0.000001) circle [radius=1];
      \draw (axis cs: 0.36,0.000004) circle [radius=1];
      \draw (axis cs: 0.40,0.00001) circle [radius=1];
      \draw (axis cs: 0.40,0.00002) circle [radius=1];
      \draw (axis cs: 0.45,0.000025) circle [radius=1];
      \draw (axis cs: 0.46,0.000034) circle [radius=1];
      \draw (axis cs: 0.45,0.000045) circle [radius=1];
      \draw (axis cs: 0.48,0.000052) circle [radius=1];
      \draw (axis cs: 0.50,0.00015) circle [radius=1];
      \draw (axis cs: 0.50,0.00025) circle [radius=1];
      \draw (axis cs: 0.57,0.00034) circle [radius=1];
      \draw (axis cs: 0.60,0.00094) circle [radius=1];
    \end{axis}
\end{tikzpicture}

1 Answers1

1

This is (an extract) of a beamer presentation I have done for the same topic you are asking.

Note, however, that:

  1. this is quite advanced TikZ/pgfplots usage; I advise you to start with the pgfplots and TikZ (and if you need it, circuitikz) tutorials before digging into this code;
  2. this is a beamer presentation, so there is the added complexity of the overlays to obtain the graph construction step-by-step; again, there are very nice tutorials around for beamer too;
  3. yes, the learning curve of these tools is steep, so if you want to avoid frustration, follow the tutorial path (or give up and use some other tool );
  4. the Ebers-Moll curve is fake. The real one is too steep a) to stay into the math limits of pgfplots and b) to produce anything really readable (reality is hard...);
  5. I am not sure all the preamble is really needed, I trimmed this down from a big presentation.

So, the code is here. I use styles a lot to avoid repeating myself.

%%%
\documentclass[10pt,
,t %% top by default
,aspectratio=169 %%
,fleqn % left aligned equations
]{beamer}
\usepackage[T1]{fontenc}

%%% \usepackage{mathtools} %% siunitx setup \usepackage{upgreek} \usepackage{textcomp} \renewcommand{\textmu}{\ensuremath{\upmu}} \renewcommand{\textohm}{\ensuremath{\Upomega}} \usepackage{siunitx} \sisetup{detect-all, retain-explicit-plus, range-phrase= --, exponent-product=\cdot, per-mode=symbol} \usepackage{pgfplots}\pgfplotsset{compat=1.15} \usetikzlibrary{calc, intersections, fit, arrows.meta, backgrounds, tikzmark, overlay-beamer-styles} % circuits \usepackage[siunitx, RPvoltages]{circuitikz} \ctikzsetstyle{romano} \tikzset{>=Stealth} % \colorlet{darkgreen}{green!50!black} \colorlet{darkblue}{blue!50!black} % %% common macros here: subscript D is too big for my tastes \newcommand{\vD}{v_{\scriptscriptstyle D}} \newcommand{\VDQ}{V_{DQ}} \newcommand{\vDtot}{v_{\scriptscriptstyle D\mathrm{tot}}} \newcommand{\iD}{i_{\scriptscriptstyle D}} \newcommand{\IDQ}{I_{DQ}} \newcommand{\iDtot}{i_{\scriptscriptstyle D\mathrm{tot}}} \newcommand{\eq}{=}%not needed in recent circuitikz % from https://tex.stackexchange.com/a/34243/38080 \newcommand{\openfrac}[3][4pt]{\genfrac{}{}{}{}{% \raisebox{#1}{$#2$}}{\raisebox{-#1}{$#3$}}} %% presentation data starts here %% \begin{document}

\begin{frame}[label=superpdiodo] \frametitle{Diode small signal} \begin{columns}[onlytextwidth, T] \begin{column}{.38\linewidth} \begin{circuitikz}[scale=0.9, transform shape, ] \draw (0,0) to[sV, v<=$v_s(t)\eq\Delta E$, ] ++(0,-2) to [battery2, invert, l=$E$] ++(0, -1) nodeground{}; \draw (0,0) to [R=$R_s$, -*] ++(3,0) node[above]{$\vD$} coordinate(vd); \draw (vd) to [D, l=D, f=$\iD$] (vd|-GND) node[ground]{}; \begin{scope}[red, overlay, visible on=<2->] \draw[decoration={brace}, decorate] (-.5,-3.5) -- ++(0,3) node[midway, left]{$E_{\mathrm{tot}}$}; \end{scope} \end{circuitikz} \end{column}% \hfill% \begin{column}{.58\linewidth} % second column \begin{tikzpicture}[] \begin{axis}[ width=8cm, height=5cm, xmin=0, xmax=1, ymin=0, ymax=11, domain=0:1, axis x line = center, axis y line = center, axis line style = {thick, gray}, enlarge x limits, enlarge y limits, xlabel = {$\vD$}, % every axis x label/.append style = {below, gray}, ylabel = {$\iD$}, legend style = {nodes={right, font=\scriptsize}, at={(0.05,0.6)}, anchor=west}, clip mode = individual, ] % notes that the values are fake to stay into PGF math \addplot[thick, smooth, name path=diodef] {1e-3exp(x/0.1)}; % \only<2->{ \addplot[red, samples=2, name path=load1 ] {6 - 6*x}; \path (0,6) coordinate(deltaE pos) node[left, red, overlay]{$E_\mathrm{tot}$}; \path[red, overlay] (0.8, 8) nodeanchor=west, inner sep=1pt, fill=white {$E_{\mathrm{tot}}=R_s\iD + \vD$}; \draw[red, overlay, ->] (F.west) -- (0.6,3);

        \path [name intersections={of=diodef and load1}] (intersection-1)
          node[circ]{} coordinate(P1);
        \draw [red, dashed] (P1|-0,0) coordinate(deltaid pos) -- (P1) --
          (P1-|0,0) coordinate(deltavd pos);
      }
      %
      \only&lt;3-&gt;{
        \addplot[blue, samples=2, name path=load2 ] {7 - 6*x};
        \path [name intersections={of=diodef and load2}] (intersection-1)
          node[circ]{} coordinate(P2);
        \draw [blue, dashed] (P2|-0,0) -- (P2) -- (P2-|0,0);
        %
        \addplot[darkgreen, samples=2, name path=load3 ] {5 - 6*x};
        \path [name intersections={of=diodef and load3}] (intersection-1)
          node[circ]{} coordinate(P3);
        \draw [darkgreen, dashed] (P3|-0,0) -- (P3) -- (P3-|0,0);
        % vstubs for sinusoidal
        \draw [thin, dashed, blue] (0,7) -- (0.2,7);
        \draw [thin, dashed, blue] (0,5) -- (0.2,5);
      }
    \end{axis}
    \pgfplotsset{minivgraph/.style={
        width=2.5cm, height=1cm, scale only axis,
        xmin=0, xmax=1000, domain=0:1000, samples=50, smooth,
        ymin=-1.1, ymax=1.1,
        axis x line = center, axis y line=center,
        xticklabel = \empty,
        yticklabel = \empty,
        every axis x label/.append style={right},
        every axis y label/.append style={at={(0.5,1)},
          anchor=center, inner sep=1pt},
        xlabel=$t$,
    }}
    \only&lt;4-&gt;{
      \begin{axis}[at=(deltaE pos), anchor=west, blue,
        minivgraph,
        ylabel=$\Delta E\eq v_s(t)$,
        ]
        \addplot [thick] {0.55*sin(x)};
      \end{axis}
    }
    \only&lt;5-&gt;{
      \begin{axis}[at=(deltavd pos), anchor=west, darkgreen,
        minivgraph,
        ylabel=$\Delta \iD$,
        ]
        \addplot [thick] {0.45*sin(x)};
      \end{axis}
      \begin{axis}[at=(deltaid pos), rotate=-90, anchor=north, red, overlay,
        minivgraph,
        width=2cm, xmax=800,
        ylabel=$\Delta \vD$,
        every axis x label/.append style={below},
        every axis y label/.append style={at={(1,1)},
          anchor=center, inner sep=1pt},
        ]
        \addplot [thick] {0.55*sin(x)};
      \end{axis}
    }
  \end{tikzpicture}
\end{column}

\end{columns} [ \iD = f(\vD) = I_0\biggl(e^{\openfrac{\vD}{V_T}}-1\biggr), \quad V_T=\SI{25.9}{\mV} \text{ at \SI{300}{\kelvin}} ] [ \vD\gg V_T \Rightarrow \iD \approx I_0e^{{\vD}/{V_T}} ] \end{frame} \end{document}

enter image description here

Rmano
  • 40,848
  • 3
  • 64
  • 125