ebook img

Scilab Textbook Companion for Linear Control Systems by BS Manke PDF

188 Pages·2017·0.58 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Scilab Textbook Companion for Linear Control Systems by BS Manke

Scilab Textbook Companion for Higher Engineering Mathematics by B. S. Grewal1 Created by Karan Arora and Kush Garg B.Tech. (pursuing) Civil Engineering Indian Institute of Technology Roorkee College Teacher Self Cross-Checked by Santosh Kumar, IIT Bombay July 31, 2019 1Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab codes written in it can be downloaded from the ”Textbook Companion Project” section at the website http://scilab.in Book Description Title: Higher Engineering Mathematics Author: B. S. Grewal Publisher: Khanna Publishers, New Delhi Edition: 40 Year: 2007 ISBN: 8174091955 1 Scilab numbering policy used in this document and the relation to the above book. Exa Example (Solved example) Eqn Equation (Particular equation of the above book) AP Appendix to Example(Scilab Code that is an Appednix to a particular Example of the above book) For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means a scilab code whose theory is explained in Section 2.3 of the book. 2 Contents 3 List of Scilab Codes 4 List of Figures 5 Chapter 1 Solution of equation and curve fitting Scilab code Exa 1.1 finding the roots of quadratic equations 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=2*(x^3)+x^2 -13*x+6 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.2 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=3*(x^3) -4*(x^2)+x+88 5 disp(” the r o o t s of above equation are ”) 6 roots(p) 6 Scilab code Exa 1.3 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^3 -7*(x^2) +36 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.6 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^4 -2*(x^3) -21*(x^2) +22*x+40 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.7 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=2*(x^4) -15*(x^3) +35*(x^2) -30*x+8 5 disp(” the r o o t s of above equation are ”) 6 roots(p) 7 Scilab code Exa 1.11 forming an equation with known roots 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 x1=poly ([0], ’ x1 ’ ); 5 x2=poly ([0], ’ x2 ’ ); 6 x3=poly ([0], ’ x3 ’ ); 7 p=x^3 -3*(x^2)+1 8 disp(” the r o o t s of above equation are ”) 9 roots(p) 10 disp(” l e t ”) 11 x1 =0.6527036 12 x2 = -0.5320889 13 x3 =2.8793852 14 disp(” so the equation whose r o o t s are cube of the r o o t s of above equation i s ( x−x1 ˆ3) ∗( x−x2 ˆ3) ∗( x− x3 ˆ3)=0 => ”) 15 p1=(x-x1^3)*(x-x2^3)*(x-x3^3) Scilab code Exa 1.12 forming an equation under restricted conditions 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 x1=poly ([0], ’ x1 ’ ); 5 x2=poly ([0], ’ x2 ’ ); 6 x3=poly ([0], ’ x3 ’ ); 7 x4=poly ([0], ’ x4 ’ ); 8 x5=poly ([0], ’ x5 ’ ); 9 x6=poly ([0], ’ x6 ’ ); 10 p=x^3 -6*(x^2) +5*x+8 11 disp(” the r o o t s of above equation are ”) 12 roots(p) 13 disp(” l e t ”) 8 14 x1 = -0.7784571 15 x2 =2.2891685 16 x3 =4.4892886 17 disp(” now , s i n c e we want equation whose sum of r o o t s i s 0 . sum of r o o t s of above equation i s 6 , so we w i l l d e c r e a s e ”) 18 disp(” value of each root by 2 i . e . x4=x1−2 ”) 19 x4=x1 -2 20 disp(”x5=x2−2”) 21 x5=x2 -2 22 disp(”x6=x3−2”) 23 x6=x3 -2 24 disp(” hence , the r e q u i r e d equation i s ( x−x4 ) ∗( x−x5 ) ∗( x−x6 )=0 −−>”) 25 p1=(x-x4)*(x-x5)*(x-x6) Scilab code Exa 1.13 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=6*(x^5) -41*(x^4) +97*(x^3) -97*(x^2) +41*x-6 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.14 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=6*(x^6) -25*(x^5) +31*(x^4) -31*(x^2) +25*x-6 5 disp(” the r o o t s of above equation are ”) 6 roots(p) 9 Scilab code Exa 1.15 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^3 -3*(x^2) +12*x+16 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.16 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=28*(x^3) -9*(x^2)+1 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.17 finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^3+x^2 -16*x+20 5 disp(” the r o o t s of above equation are ”) 6 roots(p) 10 Scilab code Exa 1.18 Finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^3 -3*(x^2)+3 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.19 Finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^4 -12*(x^3) +41*(x^2) -18*x-72 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.20 Finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^4 -2*(x^3) -5*(x^2) +10*x-3 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.21 Finding the roots of equation containing one variable 1 clear 11 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^4 -8*(x^2) -24*x+7 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.22 Finding the roots of equation containing one variable 1 clear 2 clc 3 x=poly ([0], ’ x ’ ); 4 p=x^4 -6*(x^3) -3*(x^2) +22*x-6 5 disp(” the r o o t s of above equation are ”) 6 roots(p) Scilab code Exa 1.23 Finding the solution of equation by drawing graphs 1 clear 2 clc 3 xset( ’ window ’ ,1) 4 xtitle(”My Graph”,”X a x i s ”,”Y a x i s ”) 5 x=linspace (1 ,3,30) 6 y1=3-x 7 y2=%e^(x-1) 8 plot(x,y1 ,”o−”) 9 plot(x,y2 ,”+−”) 10 legend(”3−x”,”%eˆ( x−1)”) 11 disp(” from the graph , i t i s c l e a r that the point of i n t e r s e c t i o n i s n e a r l y x=1.43 ”) 12 Figure 1.1: Finding the solution of equation by drawing graphs Scilab code Exa 1.24 Finding the solution of equation by drawing graphs 1 clear 2 clc 3 xset( ’ window ’ ,2) 4 xtitle(”My Graph”,”X a x i s ”,”Y a x i s ”) 5 x=linspace (1 ,3,30) 6 y1=x 7 y2=sin(x)+%pi/2 8 plot(x,y1 ,”o−”) 9 plot(x,y2 ,”+−”) 10 legend(”x”,” s i n ( x )+%pi/2 ”) 11 disp(” from the graph , i t i s c l e a r that the point of i n t e r s e c t i o n i s n e a r l y x=2.3 ”) Scilab code Exa 1.25 Finding the solution of equation by drawing graphs 13 Figure 1.2: Finding the solution of equation by drawing graphs 1 clear 2 clc 3 xset( ’ window ’ ,3) 4 xtitle(”My Graph”,”X a x i s ”,”Y a x i s ”) 5 x=linspace (0 ,3,30) 6 y1=-sec(x) 7 y2=cosh(x) 8 plot(x,y1 ,”o−”) 9 plot(x,y2 ,”+−”) 10 legend(”−sec ( x ) ”,” cosh ( x ) ”) 11 disp(” from the graph , i t i s c l e a r that the point of i n t e r s e c t i o n i s n e a r l y x=2.3 ”) 14

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.