I need to have four different noicy curves drawn in tikz. The four lines need to be different (they must have different amplitude and noise.)

They need to start from a their own baseline and again end at this baseline.

enter image description here

my code is as follows




\path[use as bounding box,draw,black] (0,0) rectangle (12,12);

\node [circle,draw] at (\neuronX,\neuronY) (N1) {}; 
\node [circle,draw,below right = 0.2cm and 0.2cm of N1] () {};
\node [circle,draw,below right = 0.15cm and -0.2cm of N1] () {};
\node [circle,draw,below left = 0.6cm and -0.2cm of N1] () {};
\node [circle,draw,above right = 0.05cm and 0.2cm of N1] () {};
\node [circle,draw,below right = 0.8cm and 0.3cm of N1] () {};
\node [circle,draw,below left = 0.6cm and -0.2cm of N1] (N3) {};
\node [circle,draw,below right = 1.2cm and 0.2cm of N1] (N4) {};
\node [circle,draw,below left = 1.4cm and 0.0cm of N1] (N4) {};

\node[yshift = 10.5cm,xshift = 3.5cm] () {Before Optimization};

\coordinate (A1) at (2.5,10);
\coordinate (B1) at (2,5);
\draw (A1) to [bend left=10] (B1);

\coordinate (A2) at (4 , 10);
\coordinate (B2) at (4.5 , 5);
\draw (A2) to [bend right=10] (B2);

\draw (\XA,\YA) -- (\XA,\YA-\LengthProbe) -- (\XA+\widthProbe,\YA-\LengthProbe -\widthProbe) --(\XA+\widthProbe,\YA) -- (\XA,\YA); %linear probes

\foreach \ix in {0.2,0.8,...,4.6}
\draw (\XA+0.1,\YA-\ix) rectangle (\XA+\contactPoint+0.1,\YA-\ix-\contactPoint);

\foreach \ix in {0.3,0.9,...,5.0}
\draw (\XA+0.3,\YA-\ix-0.2) rectangle (\XA+\contactPoint+0.3,\YA-\ix-\contactPoint-0.2);




An alternative in Metapost, wrapped up in luamplib, so compile this with lualatex.

enter image description here


vardef exp(expr x) = mexp(256x) enddef; % wrap MP's version of exp

vardef normal_pdf(expr x) = 
    exp(-1/2x*x)/2.50662827463  % \sqrt(2\pi) \simeq 2.50663 

vardef noisy_normal_pdf(expr w, h, noisiness, frequency) = 
    ( (-4, normal_pdf(-4) + (noisiness/128) * normaldeviate) 
    for x=frequency-4 step frequency until 4:
       -- (x, normal_pdf(x) + (noisiness/128) * normaldeviate) 
   endfor ) xscaled 0.125 w yscaled 2.50663 h
enddef;  % scaled so that the curve has width w and height h

    for r = 0 upto 4:
        draw noisy_normal_pdf(5cm, 1cm, 2r, 1/32) shifted (0,r * cm);
| improve this answer | |

This is my first attempt on creating what you asked for. Right now I cant control the frequency, but you should be able to achieve something like you wanted.

enter image description here

Some code was taken from this question: Tikz/pgf decoration that adds noise only to y coordinate



  { \pgfmathsetmacro{\delta}{rand*\pgfdecorationsegmentamplitude}

\begin{tikzpicture}[decoration={jiggly, amplitude=0.1cm}]

\draw[decoration={jiggly, amplitude=0.2cm},smooth] [decorate] 
(0,0) --++(2,1)--++(2,0)-- ++(2,-1);

\draw[decoration={jiggly, amplitude=0.3cm},smooth] [decorate] 
(0,2) --++(2,1)--++(2,0)-- ++(2,-1);

\draw[decoration={jiggly, amplitude=0.5cm},smooth] [decorate] 
(0,4) --++(2,1)--++(2,0)-- ++(2,-1);

\draw[decoration={jiggly, amplitude=0.7cm},smooth] [decorate]
(0,6) --++(2,1)--++(2,0)-- ++(2,-1);


| improve this answer | |

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.