From 8ac15bc5efafa2afc053c293152605b0e6ae60ff Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 3 Sep 2019 18:27:40 +0530 Subject: Xcos examples from textbooks and for blocks --- .../3432/CH7/EX7.26/DEPENDENCIES/fig_settings.sci | 9 ++++ Working_Examples/3432/CH7/EX7.26/Ex7_26.sce | 55 +++++++++++++++++++++ Working_Examples/3432/CH7/EX7.26/Ex7_26_f0.pdf | Bin 0 -> 18878 bytes 3 files changed, 64 insertions(+) create mode 100755 Working_Examples/3432/CH7/EX7.26/DEPENDENCIES/fig_settings.sci create mode 100755 Working_Examples/3432/CH7/EX7.26/Ex7_26.sce create mode 100755 Working_Examples/3432/CH7/EX7.26/Ex7_26_f0.pdf (limited to 'Working_Examples/3432/CH7/EX7.26') diff --git a/Working_Examples/3432/CH7/EX7.26/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH7/EX7.26/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.26/DEPENDENCIES/fig_settings.sci @@ -0,0 +1,9 @@ +//------------------------------------------------------------------ +//figure handel settings +f=get("current_figure"); //Current figure handle +f.background=8; //make the figure window background white +l=f.children(1); +l.background=8 ;//make the text background white +id=color('grey'); +xgrid(id); +//------------------------------------------------------------------ diff --git a/Working_Examples/3432/CH7/EX7.26/Ex7_26.sce b/Working_Examples/3432/CH7/EX7.26/Ex7_26.sce new file mode 100755 index 0000000..7485ee2 --- /dev/null +++ b/Working_Examples/3432/CH7/EX7.26/Ex7_26.sce @@ -0,0 +1,55 @@ +//Example 7.26 +// A reduced order estimator design for pendulum + +xdel(winsid())//close all graphics Windows +clear; +clc; +//------------------------------------------------------------------ +// State space representation +w0=1; +F=[0 1; -w0^2 0]; +G=[0 1]'; +H=[1 0]; +J=0; +n=sqrt(length(F));//order of the system + +//partioned system +Faa=F(1,1); Fab=F(1,2); +Fba=F(2,1); Fbb=F(2,2); + +// Desired estimator poles +Pe=[-10]; +// Observer gain matrix for system +L=ppol(Fbb',Fab',Pe); +L=L'; +disp(L,"L=" ); +//------------------------------------------------------------------ +//simulation for closed loop system +x0=[1 0 10]' //initial condition + +//State feedback control law u=-Kx; (from Ex7_15) +K=[3*w0^2 4*w0]; +//------------------------------------------------------------------ +//Augmented plant and observer +Faug=[F-G*K, zeros(n,1); Fab, L*Fab, Fbb-L*Fab]; +Gaug=[0 0 0]'; +Haug=[H 0]; +J=0; + +sys_aug=syslin('c',Faug,Gaug,Haug,J); +t=0:0.1:4; +u=zeros(1,length(t)); +[x z]=csim(u,t,sys_aug,x0); //closed loop response +plot(t,z(1,:),'b'); +plot(t,z(2,:),'r'); +plot(t,z(3,:),'r--'); + + +//Title, labels and grid to the figure +exec .\fig_settings.sci; // custom script for setting figure properties +title('Initial condition response of the reduced order estimator','fontsize',3) +xlabel('Time t (sec.)','fontsize',2) +ylabel('Amplitude','fontsize',2) +legend('$x_1$','$x_2$','$\hat{x}_2$') +xset('font size',2) +//------------------------------------------------------------------ diff --git a/Working_Examples/3432/CH7/EX7.26/Ex7_26_f0.pdf b/Working_Examples/3432/CH7/EX7.26/Ex7_26_f0.pdf new file mode 100755 index 0000000..96d9f50 Binary files /dev/null and b/Working_Examples/3432/CH7/EX7.26/Ex7_26_f0.pdf differ -- cgit