How do I define and plot a function involving random variable?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am struggling to define and and plot the following function:



$qquad sin(x) + 0.15,u$



where u is a uniform random variable in the range [-1, 1].



How can I define such a function and then plot it for $x$ over the range [0, 500]?










share|improve this question









New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
    – Gustavo Delfino
    1 hour ago










  • This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
    – mikado
    10 mins ago















up vote
1
down vote

favorite












I am struggling to define and and plot the following function:



$qquad sin(x) + 0.15,u$



where u is a uniform random variable in the range [-1, 1].



How can I define such a function and then plot it for $x$ over the range [0, 500]?










share|improve this question









New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
    – Gustavo Delfino
    1 hour ago










  • This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
    – mikado
    10 mins ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am struggling to define and and plot the following function:



$qquad sin(x) + 0.15,u$



where u is a uniform random variable in the range [-1, 1].



How can I define such a function and then plot it for $x$ over the range [0, 500]?










share|improve this question









New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am struggling to define and and plot the following function:



$qquad sin(x) + 0.15,u$



where u is a uniform random variable in the range [-1, 1].



How can I define such a function and then plot it for $x$ over the range [0, 500]?







graphics function-construction probability-or-statistics






share|improve this question









New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 16 mins ago









m_goldberg

83.7k870193




83.7k870193






New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









strange world

61




61




New contributor




strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






strange world is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
    – Gustavo Delfino
    1 hour ago










  • This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
    – mikado
    10 mins ago

















  • Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
    – Gustavo Delfino
    1 hour ago










  • This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
    – mikado
    10 mins ago
















Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
1 hour ago




Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
1 hour ago












This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
– mikado
10 mins ago





This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value of u for all values of x? Or do you have an independent value of u for every real value of x? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
– mikado
10 mins ago











2 Answers
2






active

oldest

votes

















up vote
3
down vote













You can define a function with randomness almost exactly like defining a regular (deterministic) function:



f[x_] := Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]];
Plot[f[x], x, 0, 10]


enter image description here



Between 0 and 500:



Plot[f[x], x, 0, 500]


enter image description here






share|improve this answer



























    up vote
    1
    down vote













    SeedRandom[0]

    data = Table[x,
    Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]], x, 0,
    500, 0.25];

    ListLinePlot[data, Frame -> True, ImageSize -> Large]


    enter image description here






    share|improve this answer




















      Your Answer





      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      strange world is a new contributor. Be nice, and check out our Code of Conduct.









       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185618%2fhow-do-i-define-and-plot-a-function-involving-random-variable%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote













      You can define a function with randomness almost exactly like defining a regular (deterministic) function:



      f[x_] := Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]];
      Plot[f[x], x, 0, 10]


      enter image description here



      Between 0 and 500:



      Plot[f[x], x, 0, 500]


      enter image description here






      share|improve this answer
























        up vote
        3
        down vote













        You can define a function with randomness almost exactly like defining a regular (deterministic) function:



        f[x_] := Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]];
        Plot[f[x], x, 0, 10]


        enter image description here



        Between 0 and 500:



        Plot[f[x], x, 0, 500]


        enter image description here






        share|improve this answer






















          up vote
          3
          down vote










          up vote
          3
          down vote









          You can define a function with randomness almost exactly like defining a regular (deterministic) function:



          f[x_] := Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]];
          Plot[f[x], x, 0, 10]


          enter image description here



          Between 0 and 500:



          Plot[f[x], x, 0, 500]


          enter image description here






          share|improve this answer












          You can define a function with randomness almost exactly like defining a regular (deterministic) function:



          f[x_] := Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]];
          Plot[f[x], x, 0, 10]


          enter image description here



          Between 0 and 500:



          Plot[f[x], x, 0, 500]


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 25 mins ago









          bill s

          52k375147




          52k375147




















              up vote
              1
              down vote













              SeedRandom[0]

              data = Table[x,
              Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]], x, 0,
              500, 0.25];

              ListLinePlot[data, Frame -> True, ImageSize -> Large]


              enter image description here






              share|improve this answer
























                up vote
                1
                down vote













                SeedRandom[0]

                data = Table[x,
                Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]], x, 0,
                500, 0.25];

                ListLinePlot[data, Frame -> True, ImageSize -> Large]


                enter image description here






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  SeedRandom[0]

                  data = Table[x,
                  Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]], x, 0,
                  500, 0.25];

                  ListLinePlot[data, Frame -> True, ImageSize -> Large]


                  enter image description here






                  share|improve this answer












                  SeedRandom[0]

                  data = Table[x,
                  Sin[x] + 0.15*RandomVariate[UniformDistribution[-1, 1]], x, 0,
                  500, 0.25];

                  ListLinePlot[data, Frame -> True, ImageSize -> Large]


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  Bob Hanlon

                  56.8k23591




                  56.8k23591




















                      strange world is a new contributor. Be nice, and check out our Code of Conduct.









                       

                      draft saved


                      draft discarded


















                      strange world is a new contributor. Be nice, and check out our Code of Conduct.












                      strange world is a new contributor. Be nice, and check out our Code of Conduct.











                      strange world is a new contributor. Be nice, and check out our Code of Conduct.













                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185618%2fhow-do-i-define-and-plot-a-function-involving-random-variable%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                      Confectionery