Last active
February 14, 2017 20:32
-
-
Save JNeiger/30314c0ecd1a683a98643940b2c90932 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear[r1mean, r1stdev, r2mean, r2stdev, r3mean, r3stdev, kmean, | |
kstdev, bUpper, bLower]; | |
r1mean = -1; r1stdev = .1; r2mean = 0; r2stdev = .1; r3mean = 0.5; \ | |
r3stdev = .2; | |
kmean = 0; kstdev = .1; bUpper = 2; bLower = -2; | |
robots = Sqrt[2*Pi] * r1stdev * | |
PDF[NormalDistribution[r1mean, r1stdev], x] + | |
Sqrt[2*Pi] * r2stdev * | |
PDF[NormalDistribution[r2mean, r2stdev], x] + | |
Sqrt[2*Pi] * r3stdev * PDF[NormalDistribution[r3mean, r3stdev], x]; | |
bounds = UnitStep[x - bUpper] + (1 - UnitStep[x - bLower]); | |
goodkick = 1 - robots - bounds; | |
kickdistr = PDF[NormalDistribution[kmean, kstdev], x]; | |
results = Convolve[goodkick, kickdistr, x, z] | |
Plot[robots, {x, -5, 5}, PlotRange -> {0, 1}] | |
Plot [1 - bounds, {x, -5, 5}, PlotRange -> {0, 1}] | |
Plot[goodkick, {x, -5, 5}, PlotRange -> {0, 1}] | |
Plot[kickdistr, {x, -5, 5}, PlotRange -> {0, 3}] | |
Plot[results, {z, -5, 5}, Filling -> Axis, ImageSize -> Full] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment