diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3432/CH7/EX7.19/Ex7_19.sce | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '3432/CH7/EX7.19/Ex7_19.sce')
-rw-r--r-- | 3432/CH7/EX7.19/Ex7_19.sce | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/3432/CH7/EX7.19/Ex7_19.sce b/3432/CH7/EX7.19/Ex7_19.sce new file mode 100644 index 000000000..013575d69 --- /dev/null +++ b/3432/CH7/EX7.19/Ex7_19.sce @@ -0,0 +1,56 @@ +//Example 7.19
+//Reference input to Type-1 control system: DC Motor
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+//------------------------------------------------------------------
+
+//Location of system Zero
+z0=2;
+
+// State space representation
+F=[0 1;0 -1];
+G=[0 1]';
+H=[1 0];
+J=0;
+n=sqrt(length(F)); //order of the system
+
+//computing state feedback matrix to place poles at assumed location [-1 -2]
+exec('./acker_dk.sci', -1);
+K=acker_dk(F,G,[-1, -2]); //assume pd=[-1 -2]
+//------------------------------------------------------------------
+//augmented matrix for tracking the reference
+A=[F G;H J];
+N=A\[zeros(1,n) 1]';
+Nx=N(1:n);
+Nu=N(n+1);
+disp(Nx,"Nx",Nu,"Nu")
+
+//feedforward gain (input weight)
+Ntilde=Nu+K*Nx;
+disp(Ntilde,"N_tilde","Input gain: N_tilde =Nu+K Nx")
+//------------------------------------------------------------------
+// Verify if ||y-r|| -> 0;
+
+syscl=syslin('c',(F-G*K),G*Ntilde,H,J); //closed loop system
+
+t=0:0.1:10;
+r=ones(1,length(t));//reference input
+[y x]=csim('step',t,syscl); //closed loop response
+
+e=sqrt((r-y).^2) //norm of error
+plot(t,y);
+plot(t,r,'m:'); //reference input
+plot(t,e,'r-.'); //norm of error
+xset('font size',3);
+xstring(3,0.83,"y")
+xstring(2,1,"r")
+xstring(3,0.1,"$\|e\|$")
+//Title, labels and grid to the figure
+exec .\fig_settings.sci; // custom script for setting figure properties
+title('Step response of undamped oscillator to reference input','fontsize',3);
+xlabel('Time t (sec.)','fontsize',2);
+ylabel('Amplitude','fontsize',2);
+zoom_rect([0 -0.1 10 1.1])
+//------------------------------------------------------------------
|