How do I define and plot a function involving random variable?
Clash 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]?
graphics function-construction probability-or-statistics
New contributor
add a comment |Â
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]?
graphics function-construction probability-or-statistics
New contributor
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 ofu
for all values ofx
? Or do you have an independent value ofu
for 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
10 mins ago
add a comment |Â
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]?
graphics function-construction probability-or-statistics
New contributor
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
New contributor
New contributor
edited 16 mins ago
m_goldberg
83.7k870193
83.7k870193
New contributor
asked 1 hour ago
strange world
61
61
New contributor
New contributor
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 ofu
for all values ofx
? Or do you have an independent value ofu
for 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
10 mins ago
add a comment |Â
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 ofu
for all values ofx
? Or do you have an independent value ofu
for 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
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
add a comment |Â
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]
Between 0 and 500:
Plot[f[x], x, 0, 500]
add a comment |Â
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]
add a comment |Â
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]
Between 0 and 500:
Plot[f[x], x, 0, 500]
add a comment |Â
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]
Between 0 and 500:
Plot[f[x], x, 0, 500]
add a comment |Â
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]
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 25 mins ago
bill s
52k375147
52k375147
add a comment |Â
add a comment |Â
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]
add a comment |Â
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]
add a comment |Â
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]
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 1 hour ago
Bob Hanlon
56.8k23591
56.8k23591
add a comment |Â
add a comment |Â
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.
strange world is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 ofx
? Or do you have an independent value ofu
for 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
10 mins ago