I have doubts about using Pots.jl

Here, you need a .+ when adding a scalar to a vector, like 0.2cos.(2t .+ π), or as suggested by @tomerarnon, use @. 0.2cos(2t + π). Also note, there is no space after function names cos ( or between 0.2 cos. Finally, range can be written shorter as below.

using Plots

t = range(0, 10, length=100) # 0:0.01:2π
y = 0.2cos.(2t .+ π)

plot(t, y, label="cos(x)")
plot!(xlab="Time (s)", ylab="Distance (m)")
2 Likes