ERROR: MethodError: no method matching -(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Float64)

The problem is

x-T

here, x is a range, so you need to broadcast your subtraction like

x .- T

as you’re trying to subtract T from every element of x, not from x itself. The error tells you this - there is no method for subtracting a Float64 number from a StepRangeLen object.

Incidentally, please make sure to quote your code by using triple backticks ``` to make it easier to read.

1 Like