You are on page 1of 21

>> A= [-9 -10;5 5]

A=

-9 -10
5

>> B=[1;1]

B=

1
1

>> C=[1 0]

C=

>> D=0

D=

>> eig(A)

ans =

-2.0000 + 1.0000i
-2.0000 - 1.0000i

>> sys = ss(A,B,C,D)

a=
x1 x2
x1 -9 -10
x2

b=
u1
x1 1
x2 1

c=
x1 x2
y1 1 0

d=
u1
y1 0

Continuous-time model.
>> [a,b,c,d] = ssdata(sys)

a=

-9 -10
5

b=

1
1

c=

d=

>> num=[1 -15]

num =

1 -15

>> den=[1 4 5]

den =

>> sys=tf(num;den)
??? sys=tf(num;den)
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> sys=tf(num,den)

Transfer function:
s - 15
------------s^2 + 4 s + 5

>> [A,B,C,D]=tf2ss(num,den)

A=

-4

-5

B=

C=

1 -15

D=

>> help step


STEP Step response of LTI models.

STEP(SYS) plots the step response of the LTI model SYS (created
with either TF, ZPK, or SS). For multi-input models, independent
step commands are applied to each input channel. The time range
and number of points are chosen automatically.

STEP(SYS,TFINAL) simulates the step response from t=0 to the


final time t=TFINAL. For discrete-time models with unspecified
sampling time, TFINAL is interpreted as the number of samples.

STEP(SYS,T) uses the user-supplied time vector T for simulation.


For discrete-time models, T should be of the form Ti:Ts:Tf
where Ts is the sample time. For continuous-time models,
T should be of the form Ti:dt:Tf where dt will become the sample

time for the discrete approximation to the continuous system. The


step input is always assumed to start at t=0 (regardless of Ti).

STEP(SYS1,SYS2,...,T) plots the step response of multiple LTI


models SYS1,SYS2,... on a single plot. The time vector T is
optional. You can also specify a color, line style, and marker
for each system, as in
step(sys1,'r',sys2,'y--',sys3,'gx').

[Y,T] = STEP(SYS) returns the output response Y and the time


vector T used for simulation. No plot is drawn on the screen.
If SYS has NY outputs and NU inputs, and LT = length(T), Y is an
array of size [LT NY NU] where Y(:,:,j) gives the step response
of the j-th input channel.

[Y,T,X] = STEP(SYS) also returns, for a state-space model SYS, the


state trajectory X, a LT-by-NX-by-NU array if SYS has NX states.

See also impulse, initial, lsim, ltiview, ltimodels.

Overloaded methods:
lti/step
idmodel/step
idfrd/step
iddata/step
idnlmodel/step
uss/step

Reference page in Help browser


doc control/step

>> step(A,B,C,D)
Warning: Using a default value of 0.2 for maximum step size. The simulation step
size will be equal to or
less than this value. You can disable this diagnostic by setting 'Automatic solver
parameter selection'
diagnostic to 'none' in the Diagnostics page of the configuration parameters
dialog.
>>
>> A= [-9 -10;5 5]

A=

-9 -10
5

>> B=[1;1]

B=

1
1

>> C=[1 0]

C=

>> D=0

D=

>> ctrb(A,B)

ans =

1 -19
1

10

>> obsv(A,C)

ans =

-9 -10

>> help place


PLACE Closed-loop pole assignment using state feedback.

K = PLACE(A,B,P) computes a state-feedback matrix K such that


the eigenvalues of A-B*K are those specified in the vector P.
No eigenvalue should have a multiplicity greater than the
number of inputs.

[K,PREC] = PLACE(A,B,P) returns PREC, an estimate of how


closely the eigenvalues of A-B*K match the specified locations P
(PREC measures the number of accurate decimal digits in the actual
closed-loop poles). A warning is issued if some nonzero closed-loop
pole is more than 10% off from the desired location.

See also acker.

Reference page in Help browser


doc place

>> P=[1 7 25]

P=

25

>> p=root(P)
??? Undefined function or method 'root' for input arguments of type 'double'.

>> p=roots(P)

p=

-3.5000 + 3.5707i
-3.5000 - 3.5707i

>> K=place(A,B,p)

K=

0.7586

2.2414

Warning: Using a default value of 0.2 for maximum step size. The simulation step
size will be equal to or
less than this value. You can disable this diagnostic by setting 'Automatic solver
parameter selection'
diagnostic to 'none' in the Diagnostics page of the configuration parameters
dialog.
>>
>> A=[-2 1; 2 -3]

A=

-2

-3

>> B=[2;0]

B=

2
0

>> C=[2 1]

C=

>> D=0

D=

>> eig(A)

ans =

-1
-4

>> obs=obsv(A,C)

obs =

-2

-1

>> rank(obs)

ans =

>> x0=[1;0]

x0 =

1
0

>> step(A,B,C,D,x0)
??? Subscript indices must either be real positive integers or logicals.

Error in ==> step at 118


sys = ss(a,b(:,iu),c,d(:,iu));

>> ss=(A,B,C,D)
??? ss=(A,B,C,D)
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.

>> sys=ss=(A,B,C,D)
??? sys=ss=(A,B,C,D)
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.

>> sys=ss(A,B,C,D)

a=
x1 x2

x1 -2 1
x2 2 -3

b=
u1
x1 2
x2 0

c=
x1 x2
y1 2 1

d=
u1
y1 0

Continuous-time model.
>> X0=[1;0]

X0 =

1
0

>> initial(sys,x0)
>> com=ctrb(A,B)

com =

-4

>> rank(com)

ans =

>> inv(com)

ans =

0.5000
0

0.5000

0.2500

>> Q=[0 0.25]

Q=

0.2500

>> T=[Q;Q*A]

T=

0.2500

0.5000 -0.7500

>> p=[-10 -20]

p=

-10 -20

>> K=place(A,B,p)

K=

12.5000 30.2500

>> A-B*K

ans =

-27.0000 -59.5000
2.0000 -3.0000

>> eig%
??? Error using ==> eig
Not enough input arguments.

>> z=A-B*K

z=

-27.0000 -59.5000
2.0000 -3.0000

>> eig(z)

ans =

-20.0000
-10.0000

>> figure (3)


>> step(z,B,C,D)
>> C[0;0]
??? C[0;0]
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> C=[0;0]

C=

0
0

>> sys1=ss(z,B,C,D)
??? Error using ==> ss.ss at 208
The values of the "a" and "c" properties must be matrices with the same number
of columns.

>> C=[2 1]

C=

>> init=[0;0]

init =

0
0

>> sys1=ss(z,B,C,D)

a=
x1
x1

x2

-27 -59.5

x2

b=
u1
x1 2
x2 0

c=
x1 x2

-3

y1 2 1

d=
u1
y1 0

Continuous-time model.
>> intial(sys1;init)
??? intial(sys1;init)
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> initial(syst1,init)
??? Undefined function or variable 'syst1'.

>> x1=[0;0]

x1 =

0
0

>> initial(sys1,x1)
>> [num,den]=tf2ss(z,B,C,D)
??? Error using ==> tf2ss
Too many input arguments.

>> [num,den]=ss2tf(z,B,C,D)

num =

4.0000 16.0000

den =

1.0000 30.0000 200.0000

>> sys2=tf(num,den)

Transfer function:
4 s + 16
---------------s^2 + 30 s + 200

>> L=[1 30 200]

L=

30 200

>> roots(L)

ans =

-20

-10

>> step(z,B,C,D)
>> [num,den]=ss2tf(A,B,C,D)

num =

16

den =

>> syss3=tf(num,den)

Transfer function:
4 s + 16
------------s^2 + 5 s + 4

>> L=[1 5 4]

L=

>> roots(L)

ans =

-4
-1

>> step(sys3)
??? Undefined function or variable 'sys3'.

>> initial(sys3)
??? Undefined function or variable 'sys3'.

You might also like