diff options
Diffstat (limited to 'Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay')
11 files changed, 3216 insertions, 0 deletions
diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/10-Non_linear_control_system.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/10-Non_linear_control_system.ipynb new file mode 100644 index 0000000..d487184 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/10-Non_linear_control_system.ipynb @@ -0,0 +1,128 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10: Non linear control system" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.1_1: Mass_dashpot_and_spring_arrangement.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 10.1.1\n", +"//mass, dashpot, spring arrangement.\n", +"clear;clc;\n", +"xdel(winsid());\n", +"M=1\n", +"K=2\n", +"F=2\n", +"A=[0 1;-2 -2]\n", +"C=eye(A)\n", +"s=%s\n", +"D=s*C-A\n", +"X=inv(D)*[1;1]\n", +"//taking the laplace transform of X\n", +"disp('X(t)=sqrt(5)*sin(t+inv(tan 0.5));sqrt(10)*sin(t+inv(tan -1/3))')\n", +"disp('The system is asymptotically stable')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.3: determination_of_quadratic_form.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.3\n", +"//determination of quadratic form\n", +"clear;clc;\n", +"xdel(winsid());\n", +"//from the given euation we get the following \n", +"A=[9 1 -2;1 4 -1;-2 -1 1]\n", +"det(A)\n", +"A1=[9 1;1 4]\n", +"det(A1)\n", +"//since determinant of A and A1 is positive\n", +"//therefore W is positive definite.\n", +"disp('W is positive definite')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.4: Lipunovs_method.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 10.4\n", +"//Lipunov's method\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"x1=poly(0,'x1');\n", +"x2=poly(0,'x2');\n", +"x11=poly(0,'x11');\n", +"x22=poly(0,'x22');\n", +"x2=x11\n", +"//assuming K1 and K2 equal to one.\n", +"disp('W=x1^2+x2^2')\n", +"//'W=x1^2+x2^2' is Liapunov's function \n", +"//W is chosen arbitrarily, since there no standard procedure for selecting W.\n", +"disp('dW/dt=2*x1*x11+2*x2*x22=-2*(x2^2+x2^4)')\n", +"disp('This will be negative semidefinite and therefore the system will be stable')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/11-Digital_control_system.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/11-Digital_control_system.ipynb new file mode 100644 index 0000000..73cc75a --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/11-Digital_control_system.ipynb @@ -0,0 +1,194 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11: Digital control system" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.6: Jurys_stability_test.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 11.6\n", +"//Jury's stability test\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"z=%z;\n", +"F=4*z^4+6*z^3+12*z^2+5*z+1\n", +"//equating the equation F with a4*z^4+a3*z^3+a2*z^2+a1*z3+a0.\n", +"a0=1\n", +"a1=5\n", +"a2=12\n", +"a3=6\n", +"a4=4\n", +"\n", +"b0=[a0 a4;a4 a0]\n", +"det(b0)\n", +"b1=[a0 a3;a4 a1]\n", +"det(b1)\n", +"b2=[a0 a2;a4 a2]\n", +"det(b2)\n", +"b3=[a0 a1;a4 a3]\n", +"det(b3)\n", +"\n", +"c0=[det(b0) det(b3);det(b3) det(b0)]\n", +"det(c0)\n", +"c1=[det(b0) det(b2);det(b3) det(b1)]\n", +"det(c1)\n", +"c2=[det(b0) det(b1);det(b3) det(b2)]\n", +"det(c2)\n", +"\n", +"disp('det(a0)<det(a4)=satisfied')\n", +"disp('det(b0)>det(b3)=satisfied')\n", +"disp('det(c0)<det(c3)=not satisfied')\n", +"\n", +"disp('The system is unstable')\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9_2a: stability_of_linear_continuous_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 11.9.2 a\n", +"//stability of linear continuous system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"G=1/(s*(s+1)*(s+2))\n", +"G1=pfss(G)\n", +"//taking Z transform of G1\n", +"z=%z;\n", +"G2=(z/(2*(z+1)))-(z/(z+%e^(-1)))+(z/(2*(z+%e^(-2))))\n", +"//upon simplification we get the following characteristic equation\n", +"B=z^3-(1.3*z^2)+0.85*z-0.5\n", +"//substituting 'z=(1+r/1-r)' in B\n", +"//the resultant equation is B1\n", +"r=poly(0,'r');\n", +"B1=3.65*r^3+1.95*r^2+2.35*r+0.05\n", +"routh_t(B1)\n", +"disp('The system is stable')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9_2b: stability_of_linear_continuous_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 11.9.2 b\n", +"//stability of linear continuous system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"G=5/(s*(s+1)*(s+2))\n", +"G1=pfss(G)\n", +"//taking Z transform of G1\n", +"z=%z;\n", +"G2=5*((z/(2*(z+1)))-(z/(z+%e^(-1)))+(z/(2*(z+%e^(-2)))))\n", +"//upon simplification we get the following characteristic equation\n", +"B=z^3-(0.5*z^2)+2.49*z-0.496\n", +"//substituting 'z=(1+r/1-r)' in B\n", +"//the resultant equation is B1\n", +"r=poly(0,'r')\n", +"B1=3.5*r^3-2.5*r^2+0.5*r+2.5\n", +"routh_t(B1)\n", +"disp('The system is unstable')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 11.9_3: Schurcohn_stability_test.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 11.9.3 \n", +"//Schurcohn stability test \n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"z=%z\n", +"G=1/(1-((7/4)*(z^-1))-((1/2)*(z^-2)))\n", +"A2=1-((7/4)*(z^-1))-((1/2)*(z^-2))\n", +"//K2=coefficient of z^-2\n", +"K2=-0.5\n", +"B2=-0.5-1.75*(z^-1)+z^-2\n", +"\n", +"A1=(A2-K2*B2)/(1-K2^2)\n", +"//K1=coefficient of z^-1\n", +"K1=-3.5\n", +"//mod(K1)>1 and mod(K2)<1\n", +"disp('The sytem is unstable')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/15-Miscellaneous_solved_problems.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/15-Miscellaneous_solved_problems.ipynb new file mode 100644 index 0000000..3663a0c --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/15-Miscellaneous_solved_problems.ipynb @@ -0,0 +1,1115 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15: Miscellaneous solved problems" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.12: solution_of_polynolynomial_equation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.12\n", +"//prove the solution of the equation\n", +"clear;clc;\n", +"xdel(winsid());\n", +"//assuming n=1\n", +"n=1;\n", +"z=%z;\n", +"y(n)=z^n;\n", +"y(n+1)=z^(n+1);\n", +"y(n+2)=z^(n+2);\n", +"A=y(n+2)+3*y(n+1)+2*y(n)\n", +"B=A/z\n", +"roots(z^2+3*z+2)\n", +"disp('y(n)=z^n is solution of polynomial equation (z+2)*(z+1)=0')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.13: Time_domain_specifications.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.13\n", +"//Time domain specifications\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"J=5.5*10^-2;\n", +"f=3.0*10^-4;\n", +"disp('wn=sqrt(k/J)=10^3*sqrt(k/5.5)')\n", +"disp('zeta=sqrt(4.9*10^-3/k)')\n", +"//at critically damped condition 'zeta=1', therefore\n", +"k=4.09*10^-3\n", +"//when k=1.5*10^-2\n", +"zeta=sqrt((4.09*10^-3)/(1.5*10^-2))\n", +"wn=10^3*sqrt(1.5*10^-2/5.5)\n", +"wd=(wn/(2*%pi))*sqrt(1-zeta^2)\n", +"//wd=frequency of damped oscillation\n", +"Pwd=1/wd\n", +"//Pwd=period of damped oscillation" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.14: Position_servomotor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.14\n", +"//position servomoter\n", +"clear;clc;\n", +"xdel(winsid());\n", +"//Mil= motor inertia referred tothe load side\n", +"Mil=20^2*0.45*10^-6 //unit= kg.m^2\n", +"//Tr= Transformation ratio of gear train between the loadshaft and the tachogenerator\n", +"Tr=20*2 \n", +"//til= tachogenerator inertia referred to the load side\n", +"til=40^2*0.35*10^-6 //unit= kg.m^2\n", +"//Til= total inertia referred to the load side\n", +"Til=(20*10^-6)+(1.8*10^-4)+(5.6*10^-4) //unit= kg.m^2\n", +"//Mi= inertia referred to the motor side\n", +"Mi=(760*10^-6)/400 //unit= kg.m^2" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.15: steady_output_speed_of_DC_motor.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.15\n", +"//steady output speed of DC motor\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"//Jm= moment of inertia of motor\n", +"Jm=6.5*10^-2;\n", +"//Fm= friction of motor\n", +"Fm=3.5*10^-3;\n", +"//a=gear ratio\n", +"a=1/100;\n", +"//Jl= inertia of load\n", +"Jl=420;\n", +"//Fl= friction of load\n", +"Fl=220;\n", +"//J= total moment of inertia\n", +"J=Jm+(a^2*Jl) //unit=kg.m^2\n", +"//F= total friction\n", +"F=Fm+(a^2*Fl) //unit=kg.m^2\n", +"s=%s\n", +"//wm1=Angular velocity in frequency domain\n", +"wm1=2/(s*((J*s)+F))\n", +"t=1;\n", +"//wm2=Angular velocity in time domain\n", +"//since 't=1', wm2 is initial value of angular velocity\n", +"wm2=(2/F)*(1-(%e^((-5.7*10^-2)/(10.7*10^-2))*t)) //unit=rad/sec\n", +"//Nm1=motor speed in rps(initial speed)\n", +"Nm1=wm2/(2*%pi);\n", +"//Nm2=motor speed in rpm\n", +"Nm2=(wm2/(2*%pi))*60; //unit=rpm\n", +"//Nl=load speed\n", +"Nl=(1/100)*((wm2/(2*%pi))*60) //unit=rpm\n", +"//Nos= steady output speed\n", +"//since Nos is steady speed, the exponential term of wn2 becomes 0.\n", +"Nos=(1/100)*(60/(2*%pi))*(2/(5.7*10^-2)) //unit=rpm\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.26: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Example 15.26\n", +"// Constructing Routh array in scilab\n", +" \n", +"clear;clc\n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"A=[5 -6 -12;-1 1 2;5 -6 -11]\n", +"B=eye(3,3)\n", +"s=%s\n", +"C=s*B-A\n", +"D=s^3+5*s^2+5*s+1; // characteristic equation after simplification\n", +"routh_t(D)\n", +"disp('No sign change in the first column, hence the system is asymptotically stable')\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.27: To_check_reachability_of_the_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Example 15.27\n", +" // To check whether the system is reachable or not\n", +"\n", +"clear;clc\n", +"xdel(winsid());\n", +"mode(0);\n", +"A=[1 0;0 1]\n", +"B=[1;1]\n", +"Wc=[A*B B]\n", +"disp('The rank of Wc=(1*1-1*1)=0,and not equal to 2. Thus the given system is not reachable ')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.28: Determine_the_stability_of_the_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Example 15.28\n", +"// Determine the stability of the system.\n", +" \n", +"clear;clc\n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"\n", +"z=%z\n", +"\n", +"D=z^3+6*z^2+8*z-0.04; // characteristic equation after simplification\n", +"routh_t(D)\n", +"disp('There is sign change in the first column, hence the system is unstable')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.2: Time_domain_specifications_of_second_order_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +" //Example 15.2\n", +" //time domain specifications of second order system\n", +" clear;clc;\n", +" xdel(winsid());\n", +" mode(0);\n", +" \n", +" //converting the given differential equation in 's' domain\n", +" //since x and y are constants\n", +" //therefoere considering 'x=y=1' \n", +" \n", +"s=%s;\n", +"g=s^2+2*s; \n", +"x=roots(g)\n", +"wn=sqrt (abs(x(1))) //undamped natural frequency\n", +"zeta=(1/wn) //damping ratio\n", +"wd=wn*sqrt(1-zeta^2)//damped natural frequency\n", +"Dc=(zeta*wn) //Dc=damping coefficient\n", +"Tc=1/(zeta*wn)//Tc=time constant of the system" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.31: Time_domain_specifications_of_second_order_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.31\n", +" //time domain specifications of second order system\n", +" clear;clc;\n", +" xdel(winsid());\n", +" mode(0);\n", +" \n", +" //converting the given differential equation in 's' domain\n", +" //since x and y are constants\n", +" //therefoere considering 'x=y=1' \n", +" \n", +"s=%s;\n", +"g=s^2+5*s+7; \n", +"x=coeff(g)\n", +"//comparing with the standard equation of second order system.\n", +"wn=sqrt(x(:,1)) //undamped natural frequency\n", +"zeta=(5/(2*wn)) //damping ratio\n", +"wd=wn*sqrt(1-zeta^2)//damped natural frequency\n", +"Tc=1/(zeta*wn)//Tc=time constant of the system" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.33: Lipunovs_method.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.33\n", +"//Lipunov's method\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"x1=poly(0,'x1');\n", +"x2=poly(0,'x2');\n", +"x11=poly(0,'x11');\n", +"x22=poly(0,'x22');\n", +"x2=x11\n", +"disp('x22+x2+x2^3+x1=0')\n", +"//(x1,x2) has singular point at (0,0)\n", +"disp('V=x1^2+x2^2')\n", +"//'V=x1^2+x2^2' is Liapunov's function \n", +"//V is positive for all values of x1 and x2, except at x1=x2=0\n", +"disp('dV/dt=2*x1*x2-2*x1*x2-2*x2^2-2*x2^4=-2*x2^2-2*x2^4')\n", +"disp('dV/dt will never be positive hence origin is stable')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.34: Find_bandwidth_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.34\n", +"//find bandwidth of the transfer function\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s\n", +"A=1\n", +"B=(s+1)\n", +"tf=A/B\n", +"\n", +"disp('when A/B(jw)=1/sqrt(2), w=w1')\n", +"\n", +"w1=(1/0.707)^2-1\n", +"//w1=bandwidth of the transfer function\n", +"\n", +"disp('Hence the bandwidth is 1 rad/sec')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.36: Impulse_response_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.36\n", +"//impulse response transfer function\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"G=syslin('c',25,s^2+4*s+25);\n", +"t=0:0.05:5;\n", +"y=csim('impuls',t,G);\n", +"plot(t,y)\n", +"xtitle('Impulse response 25/(s^2+4*s+25)','t sec','Response');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.37: step_response_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.37\n", +"//step response transfer function\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"G=syslin('c',25,s^2+4*s+25);\n", +"t=0:0.05:5;\n", +"y=csim('step',t,G);\n", +"plot(t,y)\n", +"xtitle('step response 25/(s^2+4*s+25)','t sec','Response');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.38: Roots_of_characteristic_equatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.38\n", +"//find roots of characteristic equation\n", +"\n", +"clear;clc;\n", +"xdel(winsid());\n", +"s=poly(0,'s')\n", +"G=s^4+2*s^3+s^2-2*s-1\n", +"roots(G)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.39: Bode_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example:15.39\n", +"// Bode plot in scilab\n", +" clear; clc; \n", +" xdel(winsid()); \n", +"\n", +"s=poly(0,'s');\n", +"G=syslin('c',(25),s^2+4*s+25);\n", +"clf();\n", +"bode(G,0.01,1000);\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.40: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.40\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi; \n", +" num=(1);\n", +" den=(s^2+0.8*s+1);\n", +" G=syslin('c',num,den)\n", +" clf();\n", +" nyquist(G)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.41: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.41\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi; \n", +" num=(s+2);\n", +" den=(s+1)*(s+1);\n", +" G=syslin('c',num,den)\n", +" clf();\n", +" nyquist(G)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.42: Bode_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example:15.42\n", +"// Bode plot in scilab\n", +" clear; clc; \n", +" xdel(winsid()); \n", +"\n", +"s=poly(0,'s');\n", +"G=syslin('c',(64*(s+2)),(s*(s+0.5)*(s^2+3.2*s+64)));\n", +"clf();\n", +"bode(G,0.01,1000);\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.43: Eigen_values_of_matrix.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example:15.43\n", +"//eigen values of matrix A\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"A=[0 6 -5;1 0 2;3 2 4];\n", +"spec(A)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.44: State_space_representation_of_LTI_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.44\n", +"//state space representation of LTI system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[0 1;-2 -3];\n", +"B=[0;1];\n", +"C=[1 1];\n", +"D=[0];\n", +"E=[0];\n", +"H=syslin('c',A,B,C);\n", +"s=%s;\n", +"g=eye(2,2);\n", +"P=(-s*g)-A\n", +"sm=[P B;C D];\n", +"H1=sm2ss(sm)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.45: Covariant_matrix_of_A.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.45\n", +"// Covariant matrix of 'A'\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[1 0 0;0 2 0;0 0 3]\n", +"mvvacov(A)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.49: Root_locus_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.49\n", +"// Plotting root loci of the transfer function k/s*(s+4)*(s^2+4*s+20)\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=(1); \n", +"den=s*(s+3)*(s^2+2*s+2); \n", +"G=syslin('c',num/den); \n", +"clf; \n", +"evans(G); \n", +"mtlb_axis([-5 5 -5 5]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.4: transfer_function_of_gyroscope.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.4\n", +"//Transfer function of Gyroscope\n", +"clear;clc;\n", +"xdel(winsid());\n", +"//in case of Gyroscope the equation is\n", +"\n", +"disp('(J*s^2+B*s+K)theta(s)=H*w(s)')\n", +"//therefore\n", +"disp('theta(s)/w(s)=H/J*s^2+B*s+K')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.50: Bode_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example:15.50\n", +"// Bode plot in scilab\n", +" clear; clc; \n", +" xdel(winsid()); \n", +"\n", +"s=poly(0,'s');\n", +"G=syslin('c',(16*(s+2)),(s*(s+0.5)*(s^2+3.2*s+64)));\n", +"clf();\n", +"bode(G,0.01,1000);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.53: Statespace_model_of_the_differential_equation.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15 53\n", +"//state space model of differential equation.\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"// converting the differential equation in terms of transfer function.\n", +"s=%s\n", +"//transfer function\n", +"A=1/(s^3+6*s^2+11*s+6)\n", +"B=tf2ss(A)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.54: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.54\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi; \n", +" num=(2);\n", +" den=s*(s^2+2*s+2);\n", +" G=syslin('c',num,den)\n", +" clf();\n", +" nyquist(G)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.57: determination_of_zeta_and_wn.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.57\n", +"//determination of zeta & wn\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s\n", +"num=10;\n", +"den=s^2+2*s+10; //since k=0\n", +"G=num/den;\n", +"B=coeff(den)\n", +"//wn= undamped natural ftrquency\n", +"wn=sqrt(B(:,1))\n", +"// zeta= damping ratio\n", +"zeta=2/(2*sqrt(wn))\n", +"// when time t tends to infinity, static error viz.ess tends to 0.\n", +"ess=0\n", +"// when 'zeta=0.65' i.e.(zeta1=0.65)\n", +"zeta1=0.65\n", +"k0=2*zeta1*wn-2" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.59: transfer_function_of_signal_flow_graph.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.59\n", +"// transfer function of signal flow graph\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"k1=1;\n", +"k2=5;\n", +"k3=5;\n", +"s=%s;\n", +"// From the graph the transfer function is\n", +"T=(k3*k1)/(s^3+s^2+(k3*k1)+(k1*k2*s^2)+5)\n", +"// substitutins 's=0'in the equation of T\n", +"// and differentiating and simplifying the equation\n", +"// the following value of T will appear\n", +"T1=1/(1+k1)\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.5: Transfer_function_of_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.5 (fig 15.4)\n", +"//transfer function of the system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"s=poly(0,'s');\n", +"//G1 and G2 are connected in series\n", +"G1=s^2/(s+4)^2\n", +"G2=(s+1)/(s^3*(s+3))\n", +"//H1 is feedback loop\n", +"H1=(s^2+s+1)/(s*(s+3))\n", +"// Tf=transfer function\n", +"Tf=(G1*G2*H1) \n", +"A=type(s);\n", +"disp(A,'Type of the system=')\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.60: root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.60\n", +"//root locus\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"//substituting 'a=15' in the numerator\n", +"num=2*(s+15);\n", +"den=s*(s+2)*(s+10);\n", +"G=syslin('c',num/den);\n", +"evans(G);\n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-5 5 -5 5]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.6: comparison_of_sensitivities_of_two_systems.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.6\n", +"//comparison of sensivity of the two system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"//k1 andk2 are series blocks of the transfer function\n", +"k1=100\n", +"k2=100\n", +"//transfer function of fig.15.5\n", +"T1=k1*k2/(1+(0.0099*k1*k2))\n", +"//transfer function of fig.15.6\n", +"T2=(k1/(1+(0.09*k1)))*(k2/(1+(0.09*k2)))\n", +"disp('both transfer function are equal')\n", +"//sensitivity of the transfer function T1 with respect to k1\n", +"T11=1/(1+(0.0099*k1*k2))\n", +"//sensitivity of the transfer function T2 with respect to k1\n", +"T12=1/(1+(0.09*k1))\n", +"disp('The system of fig 15.6 is 10 times more sensitive than system of fig 15.5 with respect to variations in k1')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.7: To_find_bandwidth_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.7\n", +"//find bandwidth of the transfer function\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"O=1;\n", +"R=(s+1);\n", +"tf=O/R\n", +"disp('when O/R(jw)=0.707, w=wc')\n", +"\n", +"wc=(1/0.707)^2-1\n", +"//wc=bandwidth of the transfer function\n", +"\n", +"disp('Hence the bandwidth is 1 rad/sec')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.8: Bandwidth_of_the_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.8\n", +"//find bandwidth of the transfer function\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"O=6;\n", +"R=(s^2+2*s+6);\n", +"tf=O/R\n", +"\n", +"disp('when O/R(jw)=6/sqrt(w^4-8*w+36)')\n", +"\n", +"w=[+2 -2] //after differentiation and simplification\n", +"\n", +"disp('when O/R(jw)=6/sqrt(w^4-8*w+36), At w=+-2')\n", +"\n", +"peak=3/sqrt(5)\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.9: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 15.9\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi; \n", +" num=(1);\n", +" den=s^3*(s+1);\n", +" G=syslin('c',num,den)\n", +" clf()\n", +" nyquist(G)\n", +" " + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/2-Review_of_some_mathematical_tools.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/2-Review_of_some_mathematical_tools.ipynb new file mode 100644 index 0000000..e6c3282 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/2-Review_of_some_mathematical_tools.ipynb @@ -0,0 +1,516 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Review of some mathematical tools" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.10: Inverse_of_z_transform_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.10\n", +"//inverse Z transform of 1/(1-a*z^-1)\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"// a=1\n", +"function y=f(z);\n", +" y=z/(z-1) //upon simplification of the given equation \n", +"endfunction\n", +"intc(1+%i,2-%i,f)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.11: Inverse_of_z_transform_by_power_expansion_series.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.11\n", +"//inverse z transform by power series expansion\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"z=%z;\n", +"num=2;\n", +"den=(2-(3*z^-1)+z^-2);\n", +"X=syslin('c',num/den)\n", +"//dividing the numerator and denominator by 2\n", +"num1=1;\n", +"den1=1-(1.5*(z^-1))+(0.5*(z^-2));\n", +"X1=syslin('c',(num1)/(den1))\n", +"//when mod(z)>1\n", +"//developing series expansion in negative power of z\n", +"A1=(num1)-(den1)\n", +" // multiplying the den2 by 1 and subtracting it from num1\n", +"B1=((1.5*(z^-1))-(0.5*(z^-2)))-((1.5*(z^-1))*den1) \n", +"// multiplying the den2 by (1.5*z^-1) and subtracting it from reminder of A1\n", +"C1=((1.75*z^-2)-(0.75*z^-3))-((1.75*z^-2)*den1) \n", +"// multiplying the den2 by (1.75*z^-2) and subtracting it from reminder of A1\n", +"D1=((1.875*z^-3)-(0.875*z^-4))-((1.875*z^-3)*den1) \n", +" // multiplying the den2 by (1.875*z^-3) and subtracting it from reminder of A1\n", +"E1=((1.9375*z^-4)-(0.9375*z^-5))-((1.9375*z^-4)*den1) \n", +"// multiplying the den2 by (1.9375*z^-4) and subtracting it from reminder of A1\n", +"disp('x1(n)=1,1.5,1.75,1.875,1.9375,........')\n", +"\n", +"//when mod(z)<0.5\n", +"//developing series expansion in positive power of z\n", +"A2=(num)-((2*z^2)*den) //multiplyong the den by 2*(z^2) and subtracting it from num\n", +"B2=A2-(6*z^3*den)\n", +"//multiplyong the den by 2*(z^2) and subtracting it from A2\n", +"C2=B2-(14*z^4*den)\n", +"//multiplyong the den by 2*(z^2) and subtracting it from B2\n", +"D2=C2-(30*z^5*den)\n", +"//multiplyong the den by 2*(z^2) and subtracting it from C2\n", +"E2=D2-(62*z^6*den)\n", +"//multiplyong the den by 2*(z^2) and subtracting it from D2\n", +"disp('X2(z)=2*z^2+6*z^3+14*z^4+30*z^5+62*z^6+........')\n", +"disp('x2(n)=.....,62,30,14,6,2,0,0')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.12: inverse_of_Z_transform_by_partial_fraction_method.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.12\n", +"//inverse z transform by partial fraction method\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"z=%z;\n", +"num=1;\n", +"den=((1-z^-1)^2)*(1+z^-1);\n", +"X=syslin('c',num/den)\n", +"X1=X/z\n", +"pfss(X1)\n", +"// by partial fraction the X1 will be factorised as (in terms of z)\n", +"disp('X(z)=(0.25*z/(z+1))+(0.75*z/(z-1))+(0.5*z/(z-1)^2)')\n", +"disp('X(z)=(0.25/(1+z^-1))+(0.75/(1-z^-1))+(0.5*z/(z-1)^2)')\n", +"// 0.25/(1+z^-1) is the z transform of '0.25*(-1)^n*u(n)'\n", +"// (0.75/(1-z^-1)) is the z transform of '0.75*u(n)'\n", +"//(0.5*z/(z-1)^2) is the z transform of '0.5*n*u(n)'\n", +"disp('x(n)=0.25*((-1)^n)*u(n)+0.75*u(n)+0.5*n*u(n)')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1: solving_differential_equation_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.1\n", +"//solving differential equation in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"function ydot=f(t, y)\n", +"ydot=(10/4)-(3*y/4)\n", +"endfunction\n", +"y0=1;\n", +"t0=0;\n", +"t=0:5:10;\n", +"y=ode(y0,t0,t,f)\n", +"//since't=0;5;10'\n", +"//the answer is calculated for t=0:5:10'\n", +"//thus the value of 'y'can be calculated at any value of 't'.\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2: inverse_of_laplace_transform_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.2\n", +"//Inverse laplace transform using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"s=%s;\n", +"num=(s+6);\n", +"den=(s^2+2*s+10);\n", +"F1=syslin('c',num,den)\n", +"F=pfss(F1)\n", +"//since pfss(F1) is not able to factorise F1,therefore,\n", +"//Rewriting numerator as, (s+6)=(s+1+5);\n", +"//Rewriting the denominator as, (s^2+2*s+6)=(s+1)^2+3^2;\n", +"disp('F=[((s+1)/(s+1)^2+3^2)+(5/3)*(3/(s+1)^2+3^2)]')\n", +"//From the standard formula of inverse laplace transform;\n", +"//(s+1)/(s+1)^2+3^2=%e^-t*(cos3t);\n", +"//(5/3)*(3/(s+1)^2+3^2)=(5/3)*%e^-t*(sin3t);\n", +"disp('f(t)=(%e^-t)*(cos3t)+(5/3)*(%e^-t)*(sin3t)')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3: computing_initial_value_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.3\n", +"//computing initial value using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"s=%s\n", +"n3=(3*s+2)\n", +"d3=s*(s^2+4*s+5)\n", +"F=n3/d3\n", +"//Applying initial value theorem\n", +"//when limit 's' tends to infinity, final value of 'F' becomes '0'\n", +"\n", +"disp(0,'Final value=')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4_1: eigen_values_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 2.4. a\n", +"//eigen values\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"A=[1 -1;0 -1]\n", +"B=spec(A)\n", +"disp(B,'Eigen values=')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4_b: eigen_values_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 2.4.2\n", +"//eigen values\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"A=[0 6 -5;1 0 2;3 2 4]\n", +"B=spec(A)\n", +"disp(B,'Eigen values=')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4: computing_initial_value_of_transfer_function.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.4\n", +"//computing f'(0+) and f''(0+) using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"n4=(4*s+1);\n", +"d4=s*(s^2+4*s+5);\n", +"F=n4/d4\n", +"// As per initial value theorem, limit 't' tends to zero and limit 's' tends to infinity\n", +"\n", +"//for f'(0+)\n", +"F1=s*F+0 \n", +"\n", +"for s=%inf\n", +" disp('f''(0+)=4')\n", +"end\n", +"//for f''(0+)\n", +"s=%s;\n", +"F2=((s*(F1))-(4))\n", +"\n", +"for s=%inf\n", +" disp('f''''(0+)=-15')\n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5: computing_initial_value_of_function_F_in_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.5\n", +"//computing final value of function F using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"n5=(8*s+5);\n", +"d5=s*(s+1)*(s^2+4*s+5);\n", +"F=n5/d5\n", +"F1=s*F\n", +"//for final value limit 't' tends to infinity and limit 's' tends to zero.\n", +"//When s=0, the value of F1 will be '(5/5)=1'\n", +"for s=0\n", +" disp('Final value=1') \n", +"end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6: computing_final_value_of_function_F_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.6\n", +"//computing final value of function F using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"s=%s;\n", +"n6=(5);\n", +"d6=s*(s^2+49);\n", +"F=n6/d6\n", +"F1=s*F\n", +"\n", +"disp('THE SYSTEM HAS POLES ON IMAGINARY AXIS. THEREFORE f(t) HAS NO FINAL VALUE')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.7: Inverse_laplace_transform_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.7\n", +"//Inverse laplace transform of '2/(s^2*(s+1))' using scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"s=%s;\n", +"num=2;\n", +"den=(s^2)*(s+1);\n", +"F1=syslin('c',num,den)\n", +"F=pfss(F1)\n", +"//from the partial fraction decomposition, taking out 2 as common term.\n", +"//The result would be in the form of'F(s)=2*(1/s^2-1/s+(1/s+1))'\n", +"disp('F(s)=2*((1/s^2)-(1/s)+(1/(s+1)))')\n", +"//From the standard formula of inverse laplace transform;\n", +"//(1/s^2)=t;(1/s)=1;(1/(s+1))=%e^-t\n", +"disp('f(t)=2*(t-1+e^-t)')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.8: Z_transform_of_the_signal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.8\n", +"//Z transform of the signal x(n)=(0.5)^n*u(n)\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"//u(n)is unit step input \n", +"n=2;\n", +"x=(0.5)^n;\n", +"m=1;\n", +"w=1;\n", +"phi=tand(0);\n", +"a=1;\n", +"theta=tand(45);\n", +"[cxz]=czt(x,m,w,phi,a,theta)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.9: z_transform_of_the_signal_using_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 2.9\n", +"//Z transform of the signal x(n)=(a)^n*u(n)+(b)^n*u(-n-1).\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"//u(n)is unit step input \n", +"//a=0.5 and b=0.6\n", +"n1=2;\n", +"x1=(0.5)^n1;\n", +"m1=1;\n", +"w1=1;\n", +"phi1=tand(0);\n", +"a1=1;\n", +"theta1=tand(45);\n", +"[X1]=czt(x1,m1,w1,phi1,a1,theta1)\n", +"n2=2;\n", +"x2=(0.6)^n2;\n", +"m2=1;\n", +"w2=-1;\n", +"phi2=tand(-45);\n", +"a2=1;\n", +"theta2=tand(45);\n", +"[X2]=czt(x2,m2,w2,phi2,a2,theta2)\n", +"X=X1+X2;\n", +"disp(X,'ans=')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/3-Transient_and_steady_state_behaviour_of_system.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/3-Transient_and_steady_state_behaviour_of_system.ipynb new file mode 100644 index 0000000..a108375 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/3-Transient_and_steady_state_behaviour_of_system.ipynb @@ -0,0 +1,74 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3: Transient and steady state behaviour of system" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3.1: Type_of_the_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +" //Example 3.1\n", +" //type of the system\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +"// fig(3.14)\n", +"s=%s;\n", +"n1=(2);\n", +"d1=((s)*(s^2+2*s+2));\n", +"A=n1/d1\n", +"disp('since one integration is being observed, it is TYPE 1 system')\n", +"\n", +"//fig(3.15)\n", +"s=%s;\n", +"n2=(5);\n", +"d2=((s+2)*(s^2+2*s+3));\n", +"B=n2/d2\n", +"disp('since no integration is being observed, it is TYPE 0 system')\n", +"\n", +"//fig(3.16)\n", +"s=%s;\n", +"n3=(s+1);\n", +"d3=((s^2)*(s+2));\n", +"C=n3/d3\n", +"disp('since two integration is being observed, it is TYPE 2 system')" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/4-State_variable_analysis.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/4-State_variable_analysis.ipynb new file mode 100644 index 0000000..26240c9 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/4-State_variable_analysis.ipynb @@ -0,0 +1,257 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: State variable analysis" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10: Controllable_companion_form.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 4.10\n", +"//Controllable companion form\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[1 0 0;0 2 0;0 0 3]\n", +"B=[1 0;0 1;1 1]\n", +"b1=[1;0;1]\n", +"b2=[0;1;1]\n", +"u=[B A*B A^2 B]\n", +"u1=[1 0 1;0 1 0;1 1 3]\n", +"// u1 is arranged from [b1 A^(v1-1)*b1 A^(v2-1)*b2]\n", +"// v1 and v2 are controllability indices.\n", +"u1=[b1 A*b1 b2]\n", +"v1=2;\n", +"v2=1;\n", +"inv(u1)\n", +"\n", +"p1=[-0.5 -0.5 0.5]\n", +"p2=[0 1 0]\n", +"P=[p1;p1*A;p2]\n", +"A1=P*A*inv(P)\n", +"B1=P*B\n", +"C=eye(3,3)\n", +"s=%s\n", +"D=s*C-A1\n", +"E=det(D)\n", +"routh_t(E)\n", +"//to get equation E, A must be equal to\n", +"A2=[0 1 0;0 0 1;-6 -11 -6]\n", +"B2=[0 0;1 0.5;0 1]\n", +"N1=[6 1.5 4.5;-6 -11 8]\n", +"N=N1*P" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.1: State_equatio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.1\n", +"//state equation\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"A=[0 1;-2 -3]\n", +"B=[0;1]\n", +"C=[0]\n", +"[Ac Bc U ind]=canon(A,B);\n", +"disp(clean(Ac),'Ac=');\n", +"disp(clean(Bc),'Bc=');\n", +"disp(U,'transformation matrix U=');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3: Eigen_values.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 4.3\n", +"//for given matrix 'A' proving eigen values of 'A'='t^-1*A*T'\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[0 1 0;0 0 1;-6 -11 -6] \n", +"P=bdiag(A) //eigen values of 'A'\n", +"\n", +"T=[1 1 1;-1 -2 -3; 1 4 9] //vandermode matrix\n", +"inv(T)\n", +"\n", +"A1=inv(T)*A*T //diagonal canonical form of A\n", +"\n", +"//thus 'P=A1' is proved.\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6_a: Canonical_form.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 4.6a\n", +"//example of canonical form\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[1 2 1;0 1 3;1 1 1];\n", +"B=[1;0;1];\n", +"C=[1 0 0;0 1 0;0 0 1]\n", +"S=cont_mat(A,B)\n", +"s=%s;\n", +"D=s*C-A\n", +"det(D)\n", +"//the characteristic equation i.e. det(D)=s^3-3*s^2-s-3=0 is of the form of\n", +"//s^3+a2*S^2+a1*s+a0=0. therefore comparing two equation.\n", +"a2=-3\n", +"a1=-1\n", +"a0=-3\n", +"M=[a1 a2 1;a2 1 0;1 0 0]\n", +"P=S*M\n", +"A1=inv(P)*A*P\n", +"B1=inv(P)*B" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6_b: Canonical_form.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 4.6b\n", +"//example of canonical form\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[1 2 1;0 1 3;1 1 1];\n", +"B=[1;0;1];\n", +"C=[1 1 0];\n", +"V=[C;C*A;C*A^2]\n", +"\n", +"D=eye(3,3)\n", +"s=%s\n", +"E=s*D-A\n", +"det(E)\n", +"\n", +"//the characteristic equation i.e. det(E)=s^3-3*s^2-s-3=0 is of the form of\n", +"//s^3+a2*S^2+a1*s+a0=0. therefore comparing two equation.\n", +"\n", +"a2=-3\n", +"a1=-1\n", +"a0=-3\n", +"M=[a1 a2 1;a2 1 0;1 0 0]\n", +"F=M*V\n", +"Q=inv(F)\n", +"A1=inv(Q)*A*Q\n", +"B1=inv(Q)*B\n", +"C1=C*Q" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.8: Jordan_canonical_form.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 4.8\n", +"//Jordan canonical form\n", +"clear;clc;\n", +"xdel(winsid());\n", +"A=[0 6 -5;1 0 2;3 2 4]\n", +"B=spec(A)\n", +"//Eigen vectors corresponding to eigen values of A are\n", +"p1=[2;-1;-2];\n", +"p2=[1;-0.4285;-0.7142];\n", +"p3=[1;-0.4489;-0.93877];\n", +"T=[p1 p2 p3];\n", +"A1=inv(T)*A*T" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/5-stability_of_linear_control_system.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/5-stability_of_linear_control_system.ipynb new file mode 100644 index 0000000..523d0f4 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/5-stability_of_linear_control_system.ipynb @@ -0,0 +1,374 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5: stability of linear control system" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.1: Hurwitz_stability_test.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.1\n", +"//Hurwitz stability test in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s\n", +"A=s^4+8*s^3+18*s^2+16*s+4 //characteristic equation\n", +"\n", +"//coefficients of characteristic equation\n", +"a0=det(coeff(A,4))\n", +"a1=det(coeff(A,3))\n", +"a2=det(coeff(A,2))\n", +"a3=det(coeff(A,1))\n", +"a4=det(coeff(A,0))\n", +"\n", +"D=[a1 a0 0 0;a3 a2 a1 a0;0 a4 a3 a2;0 0 0 a4]//Hurwitz determinant\n", +"\n", +"//minors of hurwitz determinant\n", +"D1=[a1]\n", +"det(D1)\n", +"D2=[a1 a0;a3 a2]\n", +"det(D2)\n", +"D3=[a1 a0 0;a3 a2 a1;0 a4 a3]\n", +"det(D3)\n", +"D4=[a1 a0 0 0;a3 a2 a1 a0;0 a4 a3 a2;0 0 0 a4]\n", +"det(D2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_2a: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 5.2.2 a\n", +"//Routh array in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=poly(0,'s')\n", +"A=s^5+s^4+2*s^3+2*s^2+4*s+6\n", +"routh_t(A)\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_2b: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 5.2.2 b\n", +"//Routh array in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=poly(0,'s')\n", +"B=s^5+2*s^4+6*s^3+12*s^2+8*s+16\n", +"routh_t(B)\n", +"// In this example a row of zero forms at s^3.\n", +"//The function automatically the derivative of the\n", +"//auxillary polynomial 2*s^4+12*s^2+16\n", +"//viz=8*s^3+24*s" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_2c: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 5.2.2 c\n", +"//Routh array in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=poly(0,'s')\n", +"p=poly(0,'p')\n", +"C=s^5+s^4+2*s^3+2*s^2+3*s+5\n", +"\n", +"//substituting 's=(1/p)' in B\n", +"//The resulting characteristic equation is\n", +"\n", +"C1=5*p^5+3*p^4+2*p^3+2*p^2+p+1\n", +"routh_t(C1)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2_2d: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 5.2.2 d\n", +"//Routh array in scilab\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=poly(0,'s')\n", +"D=2*s^6+2*s^5+3*s^4+3*s^3+2*s^2+s+1\n", +"routh_t(D)\n", +"\n", +"D1=s^2+1\n", +"//dividing the main polynomial D by the auxillary polynomial D1\n", +"D/D1\n", +"D2=2*s^4+2*s^3+s^2+s+1\n", +"routh_t(D2)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.2: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.2\n", +"//constructing Routh array in scilab\n", +" clear; clc; \n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"s=%s;\n", +"\n", +"A=s^4+4*s^3+4*s^2+3*s; // characteristic equation\n", +"\n", +"k=poly(0,'k')\n", +"\n", +"routh_t((1)/A,poly(0,'k'))\n", +"disp('0<k<2.4375')\n", +"\n", +"//the function will automatically computes Routh array\n", +"//from the Routh array the value of 'k' lies between 0 and 2.4375\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.3: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Example 5.3 \n", +" // Constructing Routh array in scilab\n", +" \n", +"clear;clc\n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"s=%s;\n", +"\n", +"A=s^4+4*s^3+4*s^2+3*s; // characteristic equation after simplification\n", +"\n", +"k=poly(0,'k')\n", +"\n", +"routh_t((1)/A,poly(0,'k'))\n", +"\n", +"//system will construct Routh array and \n", +"//from Routh array 'k' must lie between 0&39/16 i.e (0<k<2.4375)\n", +"\n", +"disp('0<k<39/16')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.4: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//example5.4\n", +"//constructing Routh array in scilab\n", +"clear;clc\n", +"xdel(winsid());//close all windows\n", +"mode(0);\n", +"s=%s;\n", +"A=s^3+8*s^2+26*s+40;\n", +"\n", +"//consider p-plane is located to the left of the s-plane. \n", +"//distance between p-plane and s-plane is 1.\n", +"//if the origin is shifted from s-plane to the p-plane,then, s=p-1\n", +"\n", +"z=%z\n", +"B=z^3+5*z^2+13*z+21;//substituting s=p-1 in the equation of A, the resulting equation will be\n", +"routh_t(B)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.5: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.5 a\n", +"//constructing Routh array in scilab\n", +"clear;clc\n", +"xdel(winsid());//close all windows\n", +"mode(0);\n", +"s=%s;\n", +"A=s^3+s^2-s+1\n", +"routh_t(A)\n", +"\n", +"//Example 5.5 b\n", +"\n", +"s=%s;\n", +"B=s^4-s^2-2*s+2\n", +"routh_t(B)\n", +"//in this example 0 occurs in the first column of the array\n", +"// for which system assumes any small value 'eps' and computes the array automatically." + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.6: Routh_array.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 5.6\n", +"//constructing Routh array in scilab\n", +" clear; clc; \n", +"xdel(winsid());\n", +"mode(0);\n", +"\n", +"s=%s;\n", +"\n", +"A=s^4+8*s^3+24*s^2+32*s; //characteristic equation\n", +"k=poly(0,'k')\n", +"\n", +"routh_t((1)/A,poly(0,'k'))\n", +"disp(k=80)\n", +"\n", +"//since from the fourth row of the Routh array \n", +"// the positive value 'k=80' will give roots with zero real part.\n", +"\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/6-study_of_the_locus_of_the_roots_of_the_characristic_equation.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/6-study_of_the_locus_of_the_roots_of_the_characristic_equation.ipynb new file mode 100644 index 0000000..7e9837a --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/6-study_of_the_locus_of_the_roots_of_the_characristic_equation.ipynb @@ -0,0 +1,249 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6: study of the locus of the roots of the characristic equation" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2_2: location_of_the_root_locus_between_poles_and_zeros.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 6.2.2\n", +"// location of root locus in between poles and zeros.\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=((s+1)*(s+2)); \n", +"den=(s*(s+3)*(s+4)); \n", +"G=syslin('c',num/den); \n", +"clf(); \n", +"evans(G); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-5 5 -5 5]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2: Root_locus_in_scilab.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.2\n", +"// Plotting root locus\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=1; \n", +"den=s*(s+3)^2; \n", +"G=syslin('c',num/den); \n", +"clf(); \n", +"evans(G); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-5 5 -5 5]);\n", +"//form the graph it can be seen that the break away point is at '-1'\n", +"disp('Break away point=-1')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.3: Root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.3\n", +"// Plotting root locus\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=(s+2); \n", +"den1=(s+1+(%i*sqrt(3)))*(s+1+(%i*sqrt(3))); \n", +"//upon simplification the denominator becomes\n", +"den2=(s^2+2*s+4)\n", +"G=syslin('c',num/den2); \n", +"clf(); \n", +"evans(G); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-5 5 -5 5]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.4: root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.4\n", +"// Plotting root locus\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=-(s+2); \n", +"den1=(s+1+(%i*sqrt(3)))*(s+1+(%i*sqrt(3))); \n", +"//upon simplification the denominator becomes\n", +"den2=(s^2+2*s+4)\n", +"G=syslin('c',num/den2); \n", +"clf(); \n", +"evans(G); \n", +"axes_handle.grid=[1 1];\n", +"mtlb_axis([-3 3 -3 3]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.5: Root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.5\n", +"// Plotting root locus\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=1; \n", +"den=s*(s+4)*(s^2+4*s+20); \n", +"G=syslin('c',num/den); \n", +"clf; \n", +"evans(G); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-5 5 -5 5]);\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6: Root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.6\n", +"// Plotting root loci in scilab\n", +"clear; clc; \n", +" xdel(winsid());\n", +"s=%s; \n", +"num=(s+2); \n", +"den=(s+1)^2; \n", +"t=syslin('c',num/den); \n", +"clf; \n", +"evans(t); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-4 4 -4 4]);" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.7: Root_locus.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 6.7\n", +"// Plotting root locus\n", +"clear; clc; \n", +" xdel(winsid());\n", +" Beta=0\n", +"s=%s; \n", +"num=1; \n", +"den=s*(s+1)*(s+Beta); \n", +"G=syslin('c',num/den); \n", +"clf(); \n", +"evans(G); \n", +"axes_handle.grid=[1 1]\n", +"mtlb_axis([-4 4 -4 4]);" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/7-Analysis_of_frequency_response.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/7-Analysis_of_frequency_response.ipynb new file mode 100644 index 0000000..99228c8 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/7-Analysis_of_frequency_response.ipynb @@ -0,0 +1,87 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7: Analysis of frequency response" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.3_1a: Bode_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 7.3.1 a\n", +"// Bode plot in scilab\n", +" clear; clc; \n", +"xdel(winsid()); \n", +"\n", +"s=poly(0,'s');\n", +"H=syslin('c',(10*(1+s)),s^2*(1+.25*s+0.0625*s^2));\n", +"clf();\n", +"bode(H,0.1,1000)" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.3_1b: Bode_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example:(i) 7.3.1 b\n", +"// Bode plot in scilab\n", +" clear; clc; \n", +" xdel(winsid()); \n", +"\n", +"s=poly(0,'s');\n", +"G=syslin('c',(8*(1+0.5*s)),s*(1+2*s)*(1+0.05*s+0.0625*s^2));\n", +"clf();\n", +"bode(G,0.01,1000);\n", +"\n", +"" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/8-stability_in_frequency_response_systems.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/8-stability_in_frequency_response_systems.ipynb new file mode 100644 index 0000000..ca87a72 --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/8-stability_in_frequency_response_systems.ipynb @@ -0,0 +1,123 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8: stability in frequency response systems" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.1: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.1\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi; \n", +" num=(1);\n", +" den=s*(s+1);\n", +" G=syslin('c',num,den)\n", +" clf();\n", +" nyquist(G)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.2: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.2\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s/2/%pi;\n", +" //since the value of 'K' and 'tau' in the given transfer function is constant\n", +" // thus assuming 'K=1' and 'tau=1' \n", +" //the resulting transfer function is,\n", +" num2=(1);\n", +" den2=(s+1)^2;\n", +" G=syslin('c',num2,den2)\n", +" clf();\n", +" nyquist(G)\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 8.3: Nyquist_plot.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example 8.3\n", +"//Nyquist plot\n", +"clear; clc; \n", +"xdel(winsid());\n", +"\n", +" s = %s /2 /%pi; \n", +" num=(s+3);\n", +" den=(s+1)*(s-1)\n", +" G=syslin('c',num,den)\n", +"clf();\n", +"nyquist(G)" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/9-compensators_and_controllers.ipynb b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/9-compensators_and_controllers.ipynb new file mode 100644 index 0000000..72fb8fa --- /dev/null +++ b/Control_Engineering_Theory_Practice_by_M_N_Bandyopadhyay/9-compensators_and_controllers.ipynb @@ -0,0 +1,99 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9: compensators and controllers" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1: compensation_in_open_loop_control_system.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Example sec 9.1\n", +"//compensation in open loop control system\n", +"clear;clc;\n", +"xdel(winsid());\n", +"\n", +"s=%s;\n", +"disp('G=(60*k)/s*(s+1)*(s+6)')\n", +"//velocity error constant 'Kv' when unit ramp input is applied to G is '5k'.\n", +"//If 'k=1',then,steady state error is 0.2.\n", +"// when 'k=35/60' G becomes \n", +"\n", +"num=35;\n", +"den=s*(s+2)*(s+6);\n", +"G1=syslin('c',num,den);\n", +"subplot(1,2,1);\n", +"evans(G1)\n", +"// From the figure 9.1\n", +"OA=sqrt((0.3)^2+(2.8)^2);\n", +"wn1=OA\n", +"theta=84 // analytically calculated\n", +"zeta1=cosd(theta)\n", +"Ts1=4/(zeta1*wn1) // Ts1=settling time in seconds\n", +"//For zeta to be 0.6 and settling time less than 0.4 sec\n", +"a=acosd(0.6)\n", +"//By drawing angle 'a' on the root locus \n", +"OB=1.26;\n", +"wn2=OB; \n", +"Ts2=4/(0.6*1.26) //in seconds\n", +"k=10.5/60;\n", +"//substituting 's=0' and '60k=10.5' in the equation for G.\n", +"Kv1=10.5/12 //Kv= velocity error coefficient\n", +"Ess1= 1/Kv1 //Ess= steady state error\n", +"//To get the required value of the zeta, steady state error increases and settling time improves.\n", +"\n", +"//inserting one zero in the expression for 'G'\n", +"disp('G2=60*k*(s+3)/s*(s+2)*(s+6)')\n", +"//considering k=1\n", +"num1=60*(s+3);\n", +"den1=(s*(s+1)*(s+6));\n", +"G3=syslin('c',num1,den1);\n", +"subplot(1,2,2);\n", +"evans(G3);\n", +"//considering 'zeta=0.6' and drawing line OA at an angle 53.13, on the root locus.\n", +"zeta=0.6;\n", +"OA1=3.4;\n", +"wn=OA1\n", +"K=16/60\n", +"Kv=(60*K*3)/(2*6)\n", +"Ts=4/(zeta*wn) //in seconds\n", +"Ess=1/Kv" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |