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/CH3/EX3.30/DEPENDENCIES/fig_settings.sci | 9 ++++ Working_Examples/3432/CH3/EX3.30/Ex3_30.sce | 46 +++++++++++++++++++++ Working_Examples/3432/CH3/EX3.30/Ex3_30_f0.pdf | Bin 0 -> 34527 bytes 3 files changed, 55 insertions(+) create mode 100755 Working_Examples/3432/CH3/EX3.30/DEPENDENCIES/fig_settings.sci create mode 100755 Working_Examples/3432/CH3/EX3.30/Ex3_30.sce create mode 100755 Working_Examples/3432/CH3/EX3.30/Ex3_30_f0.pdf (limited to 'Working_Examples/3432/CH3/EX3.30') diff --git a/Working_Examples/3432/CH3/EX3.30/DEPENDENCIES/fig_settings.sci b/Working_Examples/3432/CH3/EX3.30/DEPENDENCIES/fig_settings.sci new file mode 100755 index 0000000..5d5e7d4 --- /dev/null +++ b/Working_Examples/3432/CH3/EX3.30/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/CH3/EX3.30/Ex3_30.sce b/Working_Examples/3432/CH3/EX3.30/Ex3_30.sce new file mode 100755 index 0000000..5a06bc3 --- /dev/null +++ b/Working_Examples/3432/CH3/EX3.30/Ex3_30.sce @@ -0,0 +1,46 @@ +//Example 3.30 +//Stability versus two parameter ranges +xdel(winsid())//close all graphics Windows +clear; +clc; +//------------------------------------------------------------------ +//Stability versus parameter ranges + +num=[1 0];//zeros +den=[-1 -2];//poles +Ns=poly(num,'s','coeff'); +Ds=poly(den,'s','roots'); +Gfs=syslin('c',Ns/Ds); //forward transfer function block + +num=[1]; +den=[1 0]; +Ns=poly(num,'s','coeff'); +Ds=poly(den,'s','coeff'); +Hs=syslin('c',Ns/Ds); //feedback transfer function block + +//check the step responses with the forward, path gain K=7.5, 13, 25 +t=0:0.02:12; +i=1; +num=[5 10;1 1;0 1]; + +for i=1:3 + den=[0 1]; + Ns=poly(num(i,:),'s','coeff'); + Ds=poly(den,'s','coeff'); + Gcs=syslin('c',Ns/Ds); //Controller transfer function block + sysT= Gcs * Gfs /. Hs; + yt(i,:)=csim('step',t,sysT); + i=i+1; +end + +//Transient response for different values of K and Ki +plot(t',yt') +exec .\fig_settings.sci; //custom script for setting figure properties +title("Transient response for the system",'fontsize',3); +xlabel('Time t (sec.)','fontsize',2) +ylabel('y(t)','fontsize',2) +xset("font",1,1) +xstring(1.4,1.05,'$K=10,K_I=5$'); +xstring(3.3,0.8,'$K=1,K_I=1$'); +xstring(5.5,0.35,'$K=1,K_I=0$') +//------------------------------------------------------------------ diff --git a/Working_Examples/3432/CH3/EX3.30/Ex3_30_f0.pdf b/Working_Examples/3432/CH3/EX3.30/Ex3_30_f0.pdf new file mode 100755 index 0000000..f056d31 Binary files /dev/null and b/Working_Examples/3432/CH3/EX3.30/Ex3_30_f0.pdf differ -- cgit