Greetings everyone, so I have the following simple code with a for loop in which I want to calculate the distance a car has travelled every 10 minutes. I would like to plot each “spot” it is calculated in the for loop and add it in the diagram. But for some reason I get the error “Cannot convert Float64 to series data for plotting” in the 12th line! What could I do to overcome this problem?
using Plots
function f()
v = 119 #km/hour
D = 0.0 #distance
t_tot = 2.0 #total hours
dt = 1/6 #10 minute interval
nt = t_tot/dt; #number of iterations
t = 0.0
for i in 1:nt
t = t .+dt
D = D .+v*dt
p = scatter!(t,D)
display(p)
sleep(0.3)
end
end
f()