Graphing random spikes with MapThread

I know that using RandomVariate, I can get this graph

ListPlot[RandomVariate[NormalDistribution[20, 10^-1], 10], Filling -> Axis]

But I'd like to graph a function of $$\dfrac{1}{x}$$ and multiply it with random number above. So I tried with MapThread

MapThread[1/x, {RandomVariate[NormalDistribution[20, 10^-1], 10]}]

which gave me a list of answers

{(1/x)[19.9736], (1/x)[19.9392], (1/x)[19.9043], (1/x)[20.0796], (1/ x)[19.9381], (1/x)[19.9299], (1/x)[20.0956], (1/x)[20.0913], (1/x)[ 19.951], (1/x)[20.1328]}

But, I'm not getting any graph from

Show[Plot[MapThread[{1/x},{RandomVariate[NormalDistribution[20, 10^-1], 10]}], {x, 0, 10}]]

I must be missing something here. I'm looking to graph a 1/x function but with random spikes. Any suggestions? cheers!

• Try MapThread[#/x &, {RandomVariate[NormalDistribution[20, 10^-1], 10]}] or Map[#/x &, RandomVariate[NormalDistribution[20, 10^-1], 10]] or , simply RandomVariate[NormalDistribution[20, 10^-1], 10]/x
– kglr
Nov 20, 2021 at 15:32

1 Answer

Try this:

lst = Transpose@  {Range[1, 10],
MapThread[
Times, {Range[1, 10] /. x_ -> 1/x,
RandomVariate[NormalDistribution[20, 10^-1], 10]}]}

(*  {{1, 20.022}, {2, 9.96703}, {3, 6.69601}, {4, 4.97172}, {5,
4.02864}, {6, 3.33901}, {7, 2.84448}, {8, 2.49524}, {9,
2.22698}, {10, 2.01205}}  *)


then

ListPlot[lst, Filling -> Axis]


Have fun!