Skip to content

Commit 6e6e89a

Browse files
committed
add test for number of unstable poles
1 parent 0a540ab commit 6e6e89a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

test/test_descriptor.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ sysus = ssrand(2,3,2, stable=true)
2828
sysus.A .*= -1
2929
sys = sys + sysus
3030

31-
sysr, hs = baltrunc_coprime(sys, n=20, factorization = RobustAndOptimalControl.DescriptorSystems.glcf)
31+
sysr, hs = RobustAndOptimalControl.baltrunc_coprime(sys, n=20, factorization = RobustAndOptimalControl.DescriptorSystems.glcf)
3232

33-
@test sysr.nx == 20
33+
@test sysr.nx <= 20
3434
@test linfnorm(sysr - sys)[1] < 3e-3
3535

36+
e = poles(sysr)
37+
@test count(e->real(e)>0, e) == 2 # test that the two unstable poles were preserved
38+
3639
# bodeplot([sys, sysr])
3740

3841
## stab_unstab
@@ -48,7 +51,7 @@ sysus = ssrand(2,3,2, stable=true)
4851
sysus.A .*= -1
4952
sys = sys + sysus
5053
sysr, hs = baltrunc_unstab(sys, n=20)
51-
@test sysr.nx == 20
54+
@test sysr.nx <= 20
5255
@test linfnorm(sysr - sys)[1] < 1e-3
5356
# bodeplot([sys, sysr])
5457

0 commit comments

Comments
 (0)