green
green

Reputation: 51

Julia ALOHA simulation

I want to write ALOHA simulation but I plot this picture only G=0 1 2 3.What I need to add?

using Plots
A = []
for G in 0.0:3.0
S = G*ℯ^(-2G) 
push!(A, S)
end
println(A)
plot(A)

enter image description here

Upvotes: 2

Views: 104

Answers (2)

Benoit Pasquier
Benoit Pasquier

Reputation: 3015

Another option is

using Plots
plot(x -> x * exp(-2x), 0, 3)

which also gives

enter image description here

Upvotes: 0

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42234

Your code could be written like this, is this what you need?:

using Plots
G=0.0:0.01:3.0
A= G.*ℯ.^(-2G)
plot(G,A)

enter image description here

Upvotes: 3

Related Questions