ABMEv_utils.jl 729 Bytes
Newer Older
1
"""
2
        generalised_gaussian(x::Number,mu::Number,sigma::Number,epsilon::Number)
3
"""
4
function generalised_gaussian(x::Number,mu::Number,sigma::Number,epsilon::Number)
Victor Boussange's avatar
Victor Boussange committed
5
6
7
8
        return exp( -.5 * ((x-mu) / sigma)^epsilon)
end

"""
9
        gaussian(x::Number,mu::Number,sigma::Number) = generalised_gaussian(x,mu,sigma,2)
Victor Boussange's avatar
Victor Boussange committed
10
"""
11
gaussian(x::Number,mu::Number,sigma::Number) = generalised_gaussian(x,mu,sigma,2.)
Victor's avatar
Victor committed
12

Victor's avatar
Victor committed
13
import DSP.conv
Victor's avatar
Victor committed
14
15
16
17
18
19
20
21
22
"""
    ma(x::Array{T},f) where T <: Number
Moving average over array x, using f as the filter, i.e. the number of points to average on. Better choosing an odd number
"""
function ma(x::Array{T},f) where T <: Number
    _N = length(x)
    _s = Int((f-1)/2)
    return conv(x,ones(f)./f)[_s:_s+_N-1]
end