Dear All,
I am trying to put this function
using Plots
function test(t,t0,E,Ω)
if t<t0
E0=E*t0
test=1im*E0/Ω *(1-exp.(1im*Ω*t))
println("t is less than t0")
else
test=0
println("t is grater than t0")
end
end
plot(t->test(t,2,100,1), xlims=(0,10), label="test(t)";)
in a program but it shows me an error “MethodError: no method matching Float64(::Nothing)” while plotting.
However, if I use without 1im, it works well, e.g.
using Plots
function test(t,t0,E,Ω)
if t<t0
E0=E*t0
test=E0/Ω *(1-exp.(Ω*t))
else
test=0
end
end
plot(t->test(t,2,100,1), xlims=(0,10), label="test(t)";)
Please let me know how can I plot a complex function?