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:
begin{figure}[h!]
centering
begin{tikzpicture} [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)});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
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:
begin{figure}[h!]
centering
begin{tikzpicture} [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)});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
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:
begin{figure}[h!]
centering
begin{tikzpicture} [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)});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
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:
begin{figure}[h!]
centering
begin{tikzpicture} [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)});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
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,53711140
6,53711140
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}
usepackage{tikz}
begin{document}
begin{tikzpicture} [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)});
end{tikzpicture}
end{document}
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.
documentclass{article}
usepackage{tikz}
begin{document}
begin{figure}[h!]
centering
begin{tikzpicture} [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))});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}
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}
usepackage{tikz}
begin{document}
begin{tikzpicture} [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)});
end{tikzpicture}
end{document}
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}
usepackage{tikz}
begin{document}
begin{tikzpicture} [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)});
end{tikzpicture}
end{document}
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}
usepackage{tikz}
begin{document}
begin{tikzpicture} [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)});
end{tikzpicture}
end{document}
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}
usepackage{tikz}
begin{document}
begin{tikzpicture} [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)});
end{tikzpicture}
end{document}
edited Nov 9 at 20:59
answered Nov 9 at 20:56
AndréC
6,53711140
6,53711140
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.
documentclass{article}
usepackage{tikz}
begin{document}
begin{figure}[h!]
centering
begin{tikzpicture} [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))});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}
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.
documentclass{article}
usepackage{tikz}
begin{document}
begin{figure}[h!]
centering
begin{tikzpicture} [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))});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}
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.
documentclass{article}
usepackage{tikz}
begin{document}
begin{figure}[h!]
centering
begin{tikzpicture} [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))});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}
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.
documentclass{article}
usepackage{tikz}
begin{document}
begin{figure}[h!]
centering
begin{tikzpicture} [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))});
end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}
answered Nov 9 at 23:20
marmot
79.9k491171
79.9k491171
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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