Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. f(x) = sum([x*a>1 for a in gaussian(...)]) % some normal distribution
  2.  
  3. pgfmathdeclarefunction{gaussian}{2}{pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
  4. }
  5.  
  6. pgfmathdeclarefunction{gsum}{2}{%
  7. pgfmathsetmacroret{0}%
  8. foreach i in {#1}{%
  9. pgfmathsetmacroret{ret+(i*#2>1?1:0)}%
  10. xdefret{ret}%
  11. }%
  12. pgfmathparse{ret}%
  13. }
  14.  
  15. ...
  16.  
  17. addplot [
  18. domain=0:1.5,
  19. samples=100,
  20. color=red,
  21. ]
  22. {gsum(gaussian(0.75,0.25), x)};
Add Comment
Please, Sign In to add comment