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/CH5/EX5.7/DEPENDENCIES/fig_settings.sci | 9 ++ Working_Examples/3432/CH5/EX5.7/Ex5_7.sce | 116 +++++++++++++++++++++ Working_Examples/3432/CH5/EX5.7/Ex5_7_f0.pdf | Bin 0 -> 26278 bytes Working_Examples/3432/CH5/EX5.7/Ex5_7_f1.pdf | Bin 0 -> 30674 bytes 4 files changed, 125 insertions(+) create mode 100755 Working_Examples/3432/CH5/EX5.7/DEPENDENCIES/fig_settings.sci create mode 100755 Working_Examples/3432/CH5/EX5.7/Ex5_7.sce create mode 100755 Working_Examples/3432/CH5/EX5.7/Ex5_7_f0.pdf create mode 100755 Working_Examples/3432/CH5/EX5.7/Ex5_7_f1.pdf (limited to 'Working_Examples/3432/CH5/EX5.7') diff --git a/Working_Examples/3432/CH5/EX5.7/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH5/EX5.7/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH5/EX5.7/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/CH5/EX5.7/Ex5_7.sce b/Working_Examples/3432/CH5/EX5.7/Ex5_7.sce new file mode 100755 index 0000000..756952f --- /dev/null +++ b/Working_Examples/3432/CH5/EX5.7/Ex5_7.sce @@ -0,0 +1,116 @@ +//Example 5.7 +//Root locus for satellite control with a Collocated Flexibility. + +xdel(winsid())//close all graphics Windows +clear; +clc; + +//------------------------------------------------------------------ +//System transfer function with controller. + +s=poly(0,'s'); +NumD=(s+1); +DenD=(s+12); +D=NumD/DenD; + +NumG=(s+0.1)^2+36 +DenG=s^2*((s+0.1)^2+(6.6)^2) + +G=NumG/DenG; + +NumL=NumD*NumG; +DenL=DenD*DenG; + +L=NumL/DenL; + +zr=roots(NumL); +pl=roots(DenL); + +//------------------------------------------------------------------ +//Angle of departure. +//Find angle of departure from pole at phi1= - 0.1 + 6.6i +//(real poles don't have angle of departure, +//they move along real axis only) +//psi1=angle[(Departing pole)- (zero at - 0.1 + 6.6i)] +[Mpsi1, psi1] = polar(pl(2)-zr(1)) +psi1=real(psi1)*180/%pi; //angle in degree + +//psi2=angle[(Departing pole)- (zero at - 0.1 - 6.6i)] +[Mpsi2, psi2] = polar(pl(2)-zr(2)) +psi2=real(psi2)*180/%pi; //angle in degree + +//psi3=angle[(Departing pole)- (zero at - 1)] +[Mpsi3, psi3] = polar(pl(2)-zr(3)) +psi3=real(psi3)*180/%pi; //angle in degree + +//phi2=angle[(Departing pole)- (pole at 0)] +[Mphi2, phi2] = polar(pl(2)-pl(4)) +phi2=real(phi2)*180/%pi; //angle in degree + +//phi3 is same as phi2, as pole is repeated at 0. +phi3=phi2; + +//phi4=angle[(Departing pole)-(pole at - 0.1 - 6.6i )] +[Mphi4, phi4] = polar(pl(2)-pl(3)) +phi4=real(phi4)*180/%pi; //angle in degree + +//phi5=angle[(Departing pole)- (pole at - 12 )] +[Mphi5, phi5] = polar(pl(2)-pl(1)) +phi5=real(phi5)*180/%pi; //angle in degree + +//Therefore angle of departure phi1 at - 0.1 + 6.6i is +//phi1 = 180 + sum(angle to zeros) - sum(angle to poles) + +phi1 = 180 + sum(psi1+psi2+psi3) - sum(phi2+phi3+phi4+phi5) + +//angle contributions in figure +figure(0) +plzr(L) +xset('font size',1.5) +xarrows([real(pl(1));real(pl(2))],[imag(pl(1));imag(pl(2))],0,2) +xarc(-13,1,2,2,0,phi5*64) +xstring(-11,0.05,"$\phi_5$") + + +xarrows([real(zr(3));real(pl(2))],[imag(zr(3));imag(pl(2))],0,4) +xarc(-2,1,2,2,0,psi3*64) +xstring(-0.7,1,"$\psi_3$") + +xarrows([real(pl(4));real(pl(2))],[imag(pl(4));imag(pl(2))],0,5) +xarc(-1,1,2,2,0,phi2*64) +xstring(0.8,0.5,"$\phi_2,\,\phi_3$") + + +xarrows([real(pl(3));real(pl(2))],[imag(pl(3));imag(pl(2))],0,3) +xarc(-1,-6.6,2,2,0,phi4*64) +xstring(0.8,-7,"$\phi_4$") + +xarrows([real(zr(2));real(pl(2))],[imag(zr(2));imag(pl(2))],0,6) +xarc(-1,-5,2,2,0,psi2*64) +xstring(0.8,-5.5,"$\psi_2$") + +xarrows([real(zr(1));real(pl(2))],[imag(zr(1));imag(pl(2))],0,24) +xstring(0.3,5.5,"$\psi_1$") +xstring(0.3,6.5,"$\phi_1$") + +exec .\fig_settings.sci; //custom script for setting figure properties +title(['Figure for computing a departure angle for',... +'$L(s)=\frac{s+1}{s+12}\frac{(s+0.1)^2+6^2}{s^2[(s+0.1)^2+6.6^2]}$'],... +'fontsize',3) +zoom_rect([-15 -8 5 8]) +h=legend(''); +h.visible = "off" + +//------------------------------------------------------------------ +//Root locus system transfer function with controller. +figure(1) +evans(L) +//Title, labels and grid to the figure +exec .\fig_settings.sci; //custom script for setting figure properties +title(['Root locus for','$L(s)=\frac{s+1}{s+12}\frac{(s+0.1)^2+6^2}... +{s^2[(s+0.1)^2+6.6^2]}$'],'fontsize',3) +zoom_rect([-15 -8 5 8]) +h=legend(''); +h.visible = "off" + +//------------------------------------------------------------------ diff --git a/Working_Examples/3432/CH5/EX5.7/Ex5_7_f0.pdf b/Working_Examples/3432/CH5/EX5.7/Ex5_7_f0.pdf new file mode 100755 index 0000000..a336a69 Binary files /dev/null and b/Working_Examples/3432/CH5/EX5.7/Ex5_7_f0.pdf differ diff --git a/Working_Examples/3432/CH5/EX5.7/Ex5_7_f1.pdf b/Working_Examples/3432/CH5/EX5.7/Ex5_7_f1.pdf new file mode 100755 index 0000000..9bbc5ea Binary files /dev/null and b/Working_Examples/3432/CH5/EX5.7/Ex5_7_f1.pdf differ -- cgit