summaryrefslogtreecommitdiff
path: root/Working_Examples/3432/CH9/EX9.13/Ex9_13.sce
diff options
context:
space:
mode:
authorSiddharth Agarwal2019-09-03 18:27:40 +0530
committerSiddharth Agarwal2019-09-03 18:27:40 +0530
commit8ac15bc5efafa2afc053c293152605b0e6ae60ff (patch)
treee1bc17aae137922b1ee990f17aae4a6cb15b7d87 /Working_Examples/3432/CH9/EX9.13/Ex9_13.sce
parent52a477ec613900885e29c4a0b02806a415b4f83a (diff)
downloadXcos_block_examples-master.tar.gz
Xcos_block_examples-master.tar.bz2
Xcos_block_examples-master.zip
Xcos examples from textbooks and for blocksHEADmaster
Diffstat (limited to 'Working_Examples/3432/CH9/EX9.13/Ex9_13.sce')
-rwxr-xr-xWorking_Examples/3432/CH9/EX9.13/Ex9_13.sce54
1 files changed, 54 insertions, 0 deletions
diff --git a/Working_Examples/3432/CH9/EX9.13/Ex9_13.sce b/Working_Examples/3432/CH9/EX9.13/Ex9_13.sce
new file mode 100755
index 0000000..8857fc7
--- /dev/null
+++ b/Working_Examples/3432/CH9/EX9.13/Ex9_13.sce
@@ -0,0 +1,54 @@
+//Example 9.13
+//Determination of stability with a hysteresis nonlinearity.
+
+xdel(winsid())//close all graphics Windows
+clear;
+clc;
+//------------------------------------------------------------------
+//System Model
+s=poly(0,'s');
+num=1;
+den=(s^2+s);
+Gs=syslin('c',num/den);
+//------------------------------------------------------------------
+//Nyquist Plot of the system
+nyquist(Gs,0.25,3)
+
+// Nyquist Plot of Describing Function for hysteresis nonlinearity
+N=1;
+h=0.1;
+i=1;
+
+for omegat=0:0.05:%pi-0.1;
+ a=sin(omegat);
+ DF_nyq(i,1)=-%pi/4/N*(sqrt(a^2-h^2) + h * %i)
+ i=i+1;
+end
+
+plot(real(DF_nyq),imag(DF_nyq),'m-.')
+exec .\fig_settings.sci; // custom script for setting figure properties
+zoom_rect([-0.3 -0.3 0 0.3])
+title('Nyquist plot of system and describing function to...
+ determine limit cycle','fontsize',3)
+
+//limit cycle points
+plot(-0.1714,-0.0785,'ro');
+xstring(-0.25,0,"limit cycle point");
+xarrows([-0.2;-0.172],[0;-0.077],-1);
+
+//------------------------------------------------------------------
+//Response of the system
+K=2;
+r=1
+figure(1);
+importXcosDiagram(".\Ex9_13_model.xcos")
+xcos_simulate(scs_m,4);
+scs_m.props.context
+plot(yt.time,yt.values)
+
+xlabel('Time (sec.)');
+ylabel('Output, y');
+title("Step response displaying limit cycle oscillations",'fontsize',3);
+exec .\fig_settings.sci; //custom script for setting figure properties
+//------------------------------------------------------------------
+