%  Example 2.9.  Computes the state feedback gain and simulates.
clear
%  Define the state model matrices.
A=[0  1
   0 -1];
B=[0
   1];
C=eye(2);
D=[0 0]';
%  Define the desired pole locations.
p=[-2+2*j -2-2*j];
%  Find the state feedback gain matrix.
K=place(A,B,p)
%  Define the initial condition.
X0=[1 0]';
%  Generate the intial condition solution.
[y,x,t]=initial(A-B*K,B,C,D,X0);
%  Plot the results.
set(0,'DefaultAxesFontName','times')
set(0,'DefaultAxesFontSize',16)
set(0,'DefaultTextFontName','times')
figure(1)
clf
plot(t,y(:,1),'r-',t,y(:,2),'r--')
grid
xlabel('Time (sec)')
ylabel('Amplitude')
legend('Angle','Angle rate')
