1

I wanted to plot noisy signal at two places relative to nodes. My tex code is like this.

\newcommand\Rlblmos[1]{($(M#1.G)+(1.3,-0.2)$) node [below] {$M_{#1}$}}
\newcommand\Llblmos[1]{($(M#1.G)+(-1.3,-0.2)$) node [below] {$M_{#1}$}}
\newcommand\lblvdd[2]{(M#1.#2)node [rground,yscale=-1] (vdd){}
            ($(M#1.#2)+(0,0.75)$) node[right]{$V_{DD}$}}

\begin{tikzpicture}

    \def\Ba{0,0.5}
    \draw
        (\Ba)node[ground]{}to[I,l=$I_SS$,invert]++(0,2)node(vp){}
        (vp)to[short,*-]++(-1.5,0)node[nmos,anchor=S](M1){}\Rlblmos{1}
        (vp)to[short]++(1.5,0)node[nmos,xscale=-1,anchor=S](M2){}\Llblmos{2}                (M1.D)to[short]++(0,1.5)node[pmos,xscale=-1,anchor=D](M3){}\Llblmos{3}
        (M2.D)to[short]++(0,1.5)node[pmos,anchor=D](M4){}\Rlblmos{4}
        (M3.G)to[short]($(M3.G)!0.5!(M4.G)$)node(vy){}to[short](M4.G)
        ($(M1.D)!0.5!(M3.D)$)node(vx){}to[short,*-](vx-|vy)to[short,-*](vy)
        (vx-|M4.D)to[short,*-o]++(0.5,0)node[right]{$v_{out}$}
        ;
    \draw[ultra thick](M3.S)++(-0.5,0)to[short]($(M4.S)+(0.5,0)$);
        \begin{axis}[
        width=3cm, height=2.5cm,
        enlarge x limits=false,
        xtick=\empty,
        axis lines*=middle,
        hide y axis,
        hide x axis,
        yshift=7.5cm,
        xshift=-1.5cm
        ]
    \addplot [no markers, smooth] {sin(x)+rand*2};
    \end{axis}
        \begin{axis}[
        width=3cm, height=2.5cm,
        enlarge x limits=false,
        xtick=\empty,
        axis lines*=middle,
        hide y axis,
        hide x axis,
        yshift=4.5cm,
        xshift=-4cm
        ]
    \addplot [no markers, smooth] {sin(x)+rand*2};
    \end{axis}  
\end{tikzpicture}

and I am getting an image like this,

enter image description here

What I wanted is

  1. Both the signals I needed to be same
  2. I want them to be placed relatively to the M3.S and M3.D
  • to get them both the same you could save them as a pic – Thruston Mar 8 '17 at 13:13
  • Please post complete examples, your code cannot be compiled without the definition of \Rlblmos and \Llblmos. – Torbjørn T. Mar 8 '17 at 14:39
4

To get both random plots the same, you can set the seed to the same number, by adding \pgfmathsetseed{42} (or some other number) right before each \addplot.

For the positioning, set e.g. at={(M3.D)},anchor=east, and fine tune with xshift and yshift.

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots,circuitikz}

\begin{document}
\begin{tikzpicture}

    \def\Ba{0,0.5}
    \draw
        (\Ba)node[ground]{}to[I,l=$I_SS$,invert]++(0,2)node(vp){}
        (vp)to[short,*-]++(-1.5,0)node[nmos,anchor=S](M1){}%\Rlblmos{1}
        (vp)to[short]++(1.5,0)node[nmos,xscale=-1,anchor=S](M2){}%\Llblmos{2}
       (M1.D)to[short]++(0,1.5)node[pmos,xscale=-1,anchor=D](M3){}%\Llblmos{3}
        (M2.D)to[short]++(0,1.5)node[pmos,anchor=D](M4){}%\Rlblmos{4}
        (M3.G)to[short]($(M3.G)!0.5!(M4.G)$)node(vy){}to[short](M4.G)
        ($(M1.D)!0.5!(M3.D)$)node(vx){}to[short,*-](vx-|vy)to[short,-*](vy)
        (vx-|M4.D)to[short,*-o]++(0.5,0)node[right]{$v_{out}$}
        ;
    \draw[ultra thick](M3.S)++(-0.5,0)to[short]($(M4.S)+(0.5,0)$);
        \begin{axis}[
        width=3cm, height=2.5cm,
        enlarge x limits=false,
        xtick=\empty,
        axis lines*=middle,
        hide y axis,
        hide x axis,
        at={(M3.S)},
        anchor=south,
        yshift=3mm
        ]
\pgfmathsetseed{42}
    \addplot [no markers, smooth] {sin(x)+rand*2};
    \end{axis}
        \begin{axis}[
        width=3cm, height=2.5cm,
        enlarge x limits=false,
        xtick=\empty,
        axis lines*=middle,
        hide y axis,
        hide x axis,
        at={(M3.D)},
        anchor=east,
        xshift=-3mm
        ]
\pgfmathsetseed{42}
    \addplot [no markers, smooth] {sin(x)+rand*2};
    \end{axis}  

\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.