Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • tommi
  • gh-pages
  • v0.2.0
  • v0.1.0
5 results

runtests.jl

Blame
  • runtests.jl 1.02 KiB
    using Base.Test
    using BallAndBeam
    
    function test_sysfilter()
            N = 10
            u = randn(N)
            b = [1, 1]
            a = [1, 0.1, 1]
    	  sys = ss(tf(b,a,1))
    	state = init_sysfilter(sys)
           yf = filt(b,a,u)
    	  yff = similar(yf)
    	for i in eachindex(u)
    		yff[i] = sysfilter!(state, sys, u[i])[1]
    	end
    	@test sum(abs,yf - yff) < √(eps())
    end
    
    test_sysfilter()
    
    bias           = 0 # Change this if your process drifts over time
    settling_time  = 1
    nbr_of_periods = 5
    
    w1_100 = logspace(log10(1),log10(300),8)
    G1 = Number[w1_100 Complex.(ones(8),0)]
    
    w1_200 = logspace(log10(5),log10(50),20)
    G2 = Number[w1_200 Complex.(ones(20),0)]
    
    # Concatenate (overlapping) estimates to be used and sort based on freq
    G12 = sortfqs([G1; G2])
    
    bopl(G12)
    nypl(G12)
    
    Control ==================================================================================
    polevect = [1]
    zerovect = []
    gain     = 1
    
    sysFBc,L,T,C = fbdesign(G12, polevect, zerovect, gain)
    sysFFc,YR,FF = ffdesign(T, polevect, zerovect, gain)
    sysFB,sysFF  = c2d(sysFBc,h),c2d(sysFFc,h)