How to draw the cdf of an exponential random variable in Tikz
up vote
6
down vote
favorite
So the task is to create a TikZ
figure of the CDF of an exponential random variable for three different choices of the rate parameter λ
and for x
between 0 and 5 (using λ = 0.5
, λ = 1
and λ = 1.5
). The three different CDF’s should be on the same graph and distinguished by colour. The axes should be labelled.
so far I have:
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
This is returning error messages saying there are too many closing brackets and I am unsure of where to go from here, as I have tried several different changes and none of them have worked.
Thank you!
tikz-pgf floats
add a comment |
up vote
6
down vote
favorite
So the task is to create a TikZ
figure of the CDF of an exponential random variable for three different choices of the rate parameter λ
and for x
between 0 and 5 (using λ = 0.5
, λ = 1
and λ = 1.5
). The three different CDF’s should be on the same graph and distinguished by colour. The axes should be labelled.
so far I have:
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
This is returning error messages saying there are too many closing brackets and I am unsure of where to go from here, as I have tried several different changes and none of them have worked.
Thank you!
tikz-pgf floats
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
So the task is to create a TikZ
figure of the CDF of an exponential random variable for three different choices of the rate parameter λ
and for x
between 0 and 5 (using λ = 0.5
, λ = 1
and λ = 1.5
). The three different CDF’s should be on the same graph and distinguished by colour. The axes should be labelled.
so far I have:
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
This is returning error messages saying there are too many closing brackets and I am unsure of where to go from here, as I have tried several different changes and none of them have worked.
Thank you!
tikz-pgf floats
So the task is to create a TikZ
figure of the CDF of an exponential random variable for three different choices of the rate parameter λ
and for x
between 0 and 5 (using λ = 0.5
, λ = 1
and λ = 1.5
). The three different CDF’s should be on the same graph and distinguished by colour. The axes should be labelled.
so far I have:
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
This is returning error messages saying there are too many closing brackets and I am unsure of where to go from here, as I have tried several different changes and none of them have worked.
Thank you!
tikz-pgf floats
tikz-pgf floats
edited Nov 9 at 21:00
AndréC
6,32711140
6,32711140
asked Nov 9 at 20:42
ScarW
311
311
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
This is because mathematical functions with tikz
are not written like LaTeX
macros. They are written without the reverse bar
All you have to do is write:
draw[color=green, thick] plot(x,1-exp(-x));
documentclass[12pt]article
usepackagetikz
begindocument
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
enddocument
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
add a comment |
up vote
3
down vote
AndréC already told you what's causing the error. But from your title I am wondering if you are looking for something like the following.
documentclassarticle
usepackagetikz
begindocument
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:6]
draw[latex-latex](0,2.2) node[left]$y$ |- (6.2,0) node[below]$x$;
foreach X/Col in 0.5/green!60!black,1/blue,2/red
draw[color=Col, thick] plot[variable=x,smooth] (x,1-tanh(X*(3-x)));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
enddocument
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
This is because mathematical functions with tikz
are not written like LaTeX
macros. They are written without the reverse bar
All you have to do is write:
draw[color=green, thick] plot(x,1-exp(-x));
documentclass[12pt]article
usepackagetikz
begindocument
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
enddocument
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
add a comment |
up vote
3
down vote
This is because mathematical functions with tikz
are not written like LaTeX
macros. They are written without the reverse bar
All you have to do is write:
draw[color=green, thick] plot(x,1-exp(-x));
documentclass[12pt]article
usepackagetikz
begindocument
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
enddocument
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
add a comment |
up vote
3
down vote
up vote
3
down vote
This is because mathematical functions with tikz
are not written like LaTeX
macros. They are written without the reverse bar
All you have to do is write:
draw[color=green, thick] plot(x,1-exp(-x));
documentclass[12pt]article
usepackagetikz
begindocument
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
enddocument
This is because mathematical functions with tikz
are not written like LaTeX
macros. They are written without the reverse bar
All you have to do is write:
draw[color=green, thick] plot(x,1-exp(-x));
documentclass[12pt]article
usepackagetikz
begindocument
begintikzpicture [xscale = 1, yscale=1, domain=0:2]
draw[<->](0,0)--(1,0) node[above]$x$;
draw[<->](0,0)--(0,1) node[right]$y$;
draw[color=green, thick] plot(x,1-exp(-x));
endtikzpicture
enddocument
edited Nov 9 at 20:59
answered Nov 9 at 20:56
AndréC
6,32711140
6,32711140
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
add a comment |
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
1
1
Good catch!!!!!
– marmot
Nov 9 at 20:57
Good catch!!!!!
– marmot
Nov 9 at 20:57
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
@marmot thanks you !!! :)
– AndréC
Nov 9 at 20:58
add a comment |
up vote
3
down vote
AndréC already told you what's causing the error. But from your title I am wondering if you are looking for something like the following.
documentclassarticle
usepackagetikz
begindocument
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:6]
draw[latex-latex](0,2.2) node[left]$y$ |- (6.2,0) node[below]$x$;
foreach X/Col in 0.5/green!60!black,1/blue,2/red
draw[color=Col, thick] plot[variable=x,smooth] (x,1-tanh(X*(3-x)));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
enddocument
add a comment |
up vote
3
down vote
AndréC already told you what's causing the error. But from your title I am wondering if you are looking for something like the following.
documentclassarticle
usepackagetikz
begindocument
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:6]
draw[latex-latex](0,2.2) node[left]$y$ |- (6.2,0) node[below]$x$;
foreach X/Col in 0.5/green!60!black,1/blue,2/red
draw[color=Col, thick] plot[variable=x,smooth] (x,1-tanh(X*(3-x)));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
enddocument
add a comment |
up vote
3
down vote
up vote
3
down vote
AndréC already told you what's causing the error. But from your title I am wondering if you are looking for something like the following.
documentclassarticle
usepackagetikz
begindocument
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:6]
draw[latex-latex](0,2.2) node[left]$y$ |- (6.2,0) node[below]$x$;
foreach X/Col in 0.5/green!60!black,1/blue,2/red
draw[color=Col, thick] plot[variable=x,smooth] (x,1-tanh(X*(3-x)));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
enddocument
AndréC already told you what's causing the error. But from your title I am wondering if you are looking for something like the following.
documentclassarticle
usepackagetikz
begindocument
beginfigure[h!]
centering
begintikzpicture [xscale = 1, yscale=1, domain=0:6]
draw[latex-latex](0,2.2) node[left]$y$ |- (6.2,0) node[below]$x$;
foreach X/Col in 0.5/green!60!black,1/blue,2/red
draw[color=Col, thick] plot[variable=x,smooth] (x,1-tanh(X*(3-x)));
endtikzpicture
captionCaption
labelfig:my_label
endfigure
enddocument
answered Nov 9 at 23:20
marmot
78.8k487166
78.8k487166
add a comment |
add a comment |
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459203%2fhow-to-draw-the-cdf-of-an-exponential-random-variable-in-tikz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown