% Example 7.1 Observability
A=[-1 0;0 -1];
C=[1 -1];

Wo=obsv(A,C) % short way to write for big A,B
Wo=[C;C*A]   % textbook way
det(Wo)

% let's try to simulate
B=[0;0];                % no inputs
D=0;                    % no direct term
P=ss(A,B,C,D);          % state space system
t=0:.01:10;             % simulation time vector
u=0*t;                  % corresponding input

x0=[1;0]                % observable state vector
figure(1)
y=lsimplot(P,u,t,x0)
title('observable')

x0=[1;1]                % non-observable state vector
figure(2)               % new figure
y=lsimplot(P,u,t,x0)
title('non-observable')