How do I define and plot a function involving random variable? [closed]
up vote
2
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]?
graphics function-construction probability-or-statistics
closed as unclear what you're asking by Pillsy, Sektor, JimB, N.J.Evans, gwr Nov 9 at 22:57
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
2
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]?
graphics function-construction probability-or-statistics
closed as unclear what you're asking by Pillsy, Sektor, JimB, N.J.Evans, gwr Nov 9 at 22:57
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
2
This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value ofufor all values ofx? Or do you have an independent value ofufor every real value ofx? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
– mikado
Nov 8 at 19:31
add a comment |
up vote
2
down vote
favorite
up vote
2
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]?
graphics function-construction probability-or-statistics
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
graphics function-construction probability-or-statistics
edited Nov 8 at 19:25
m_goldberg
83.8k870193
83.8k870193
asked Nov 8 at 17:42
strange world
111
111
closed as unclear what you're asking by Pillsy, Sektor, JimB, N.J.Evans, gwr Nov 9 at 22:57
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Pillsy, Sektor, JimB, N.J.Evans, gwr Nov 9 at 22:57
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
2
This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value ofufor all values ofx? Or do you have an independent value ofufor every real value ofx? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
– mikado
Nov 8 at 19:31
add a comment |
1
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
2
This is not really a well-defined problem. You are wanting to plot a realisation of a random process. Do you have one value ofufor all values ofx? Or do you have an independent value ofufor every real value ofx? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.
– mikado
Nov 8 at 19:31
1
1
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
2
2
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
Nov 8 at 19:31
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
Nov 8 at 19:31
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
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}]

Between 0 and 500:
Plot[f[x], {x, 0, 500}]

add a comment |
up vote
2
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]

Thank you very much guys!!
– strange world
Nov 8 at 20:17
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
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}]

Between 0 and 500:
Plot[f[x], {x, 0, 500}]

add a comment |
up vote
4
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}]

Between 0 and 500:
Plot[f[x], {x, 0, 500}]

add a comment |
up vote
4
down vote
up vote
4
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}]

Between 0 and 500:
Plot[f[x], {x, 0, 500}]

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}]

Between 0 and 500:
Plot[f[x], {x, 0, 500}]

answered Nov 8 at 19:16
bill s
52.2k375148
52.2k375148
add a comment |
add a comment |
up vote
2
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]

Thank you very much guys!!
– strange world
Nov 8 at 20:17
add a comment |
up vote
2
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]

Thank you very much guys!!
– strange world
Nov 8 at 20:17
add a comment |
up vote
2
down vote
up vote
2
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]

SeedRandom[0]
data = Table[{x,
Sin[x] + 0.15*RandomVariate[UniformDistribution[{-1, 1}]]}, {x, 0,
500, 0.25}];
ListLinePlot[data, Frame -> True, ImageSize -> Large]

answered Nov 8 at 18:31
Bob Hanlon
57.5k23591
57.5k23591
Thank you very much guys!!
– strange world
Nov 8 at 20:17
add a comment |
Thank you very much guys!!
– strange world
Nov 8 at 20:17
Thank you very much guys!!
– strange world
Nov 8 at 20:17
Thank you very much guys!!
– strange world
Nov 8 at 20:17
add a comment |
1
Take a look at UniformDistribution and TransformedDistribution. I think it may help you.
– Gustavo Delfino
Nov 8 at 18:29
2
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
ufor all values ofx? Or do you have an independent value ofufor every real value ofx? If the latter, when you plot it (at any resolution) you will only see a vertical bar around the curve.– mikado
Nov 8 at 19:31