Skip to content

Instantly share code, notes, and snippets.

@ninux
Created June 16, 2014 08:50
Show Gist options
  • Save ninux/bffcfb366b668e4dd41f to your computer and use it in GitHub Desktop.
Save ninux/bffcfb366b668e4dd41f to your computer and use it in GitHub Desktop.
some fun with gnu octaves' control package
# Octave 3.8.1, Mon Jun 16 09:08:01 2014 CEST <ninux@x200>
pkg load control signal
G = zpk([];[-1,-1; -1,1],1);
G = zpk([],[-1,-1; -1,1],1);
H = zpk([],[-2,-1; -2,1],1);
zplane(G,H)
graphics_toolkit("gnuplot")
zplane(G)
s = tf('s')
G = zpk([],[-1,-1; -1,1],1);
H = zpk([],[-2,-1; -2,1],1);
zplane(G,H)
F = 1/(s+1)
zplane(F)
zplane([],[-1,1;-1,-1])
zplane([-1,-1],[1;-1])
pzmap(G)
pzmap(H)
G = zpk([],[-1,-1; -1,1],1);
pzmap(G)
a=pzmap(G)
[a,b]=pzmap(G)
a
G = zpk([],[-1,-1*i; -1,1*i],1);
[a,b]=pzmap(G)
[a,b]=pzmap(G)
pzmap(G)
[a,b]=pzmap(G)
G
[a,b]=pzmap(G)
G = zp2sys([],[-1,-1*i; -1,1*i],1);
G = zp2sys([],[-1,1],1);
G = zp2sys([0],[-1,1],1);
G = zp2ft([0],[-1,1],1);
G = zp2tf([0],[-1,1],1);
g
G
G = zp2tf([],[-1,1],1);
G
G = zp2sys([],[-1,1],1);
G1 = (1)/((s+(1+i))*(s+(1-i)))
s = tf('s')
G1 = (1)/((s+(1+i))*(s+(1-i)))
G1 = (1)/((s+(1))*(s+(1)))
a = 1+i
G1 = (1)/((s+(1+1i))*(s+(1-1i)))
G1 = (1)/(s+1i)
G1 = (1)/(s+1)
G1 = (1)/(s+(1+1i))
G1 = (1)/(s+1)
G1 = (1)/(s^2 + 2*s + 2)
G2 = (1)/(s^2 + 4*s + 5)
zplane(G1,G2)
pzmap(G1,G2)
step(G1,G2)
step(G1,G2,10)
step(G1,G2,10,1e-5)
step(G1,G2,10,1e-3)
G2 = (5)/(s^2 + 4*s + 5)
step(G1,G2,10,1e-3)
G3 = (17)/(s^2 + 8*s + 17)
step(G1,G2,G3,10,1e-3)
step(G1,G2,G3,10,1e-3)
G4 = (1.25)/(s^2 + 1*s + 1.25)
step(G1,G2,G3,G4,10,1e-3)
G5 = (1.01)/(s^2 + 0.2*s + 1.01)
G5 = (1.01)/(s^2 + 0.2*s + 1.01)
step(G1,G2,G3,G4,G5,10,1e-3)
G6 = (4.01)/(s^2 + 0.2*s + 4.01)
step(G1,G2,G3,G4,G5,G6,10,1e-3)
step(G1,G2,G3,G4,G5,G6,30,1e-3)
step(G1,G2,G3,G4,G5,G6,10,1e-3)
step(G1,G2,G3,G4,G5,G6,30,1e-3)
G7 = (1)/(s+0.1)
step(G1,G2,G3,G4,G5,G6,G7,30,1e-3)
G7 = (0.1)/(s+0.1)
step(G1,G2,G3,G4,G5,G6,G7,30,1e-3)
H1 = (2)/(s^2 -2*s + 2)
step(H1,10,1e-2)
step(H1,30,1e-2)
H2 = (1.01)/(s^2 -0.2*s + 1.01)
step(H1,H2,30,1e-2)
step(H1,H2,100,1e-2)
step(H1,H2,10000,1e-2)
step(H1,H2,1000,1e-2)
step(H1,H2,1000,1e-0)
step(H2,10,1e-2)
step(H2,30,1e-2)
step(H2,100,1e-2)
step(H2,1,1e-2)
step(H2,1,10e-2)
step(H2,10,1e-2)
H3 = (4.01)/(s^2 -0.2*s + 4.01)
step(H2,H3,10,1e-2)
H3 = (0.1)/(s - 0.1)
H3 = (4.01)/(s^2 -0.2*s + 4.01)
H4 = (0.1)/(s - 0.1)
step(H2,H3,H4,10,1e-2)
step(H2,H3,-H4,10,1e-2)
step(H2,H3,-H4,30,1e-2)
step(H2,H3,-H4,H4,30,1e-2)
step(H2,H3,-H4,H4+1,30,1e-2)
step(H2,H3,-H4,H4+2,30,1e-2)
history -w gist.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment