Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f(x) = sum([x*a>1 for a in gaussian(...)]) % some normal distribution
- pgfmathdeclarefunction{gaussian}{2}{pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
- }
- pgfmathdeclarefunction{gsum}{2}{%
- pgfmathsetmacroret{0}%
- foreach i in {#1}{%
- pgfmathsetmacroret{ret+(i*#2>1?1:0)}%
- xdefret{ret}%
- }%
- pgfmathparse{ret}%
- }
- ...
- addplot [
- domain=0:1.5,
- samples=100,
- color=red,
- ]
- {gsum(gaussian(0.75,0.25), x)};
Add Comment
Please, Sign In to add comment