summaryrefslogtreecommitdiff
path: root/104/CH2
diff options
context:
space:
mode:
Diffstat (limited to '104/CH2')
-rwxr-xr-x104/CH2/EX2.1/2_1.sce4
-rwxr-xr-x104/CH2/EX2.10/2_10.sce4
-rwxr-xr-x104/CH2/EX2.12/2_12.sce4
-rwxr-xr-x104/CH2/EX2.13/2_13.sce5
-rwxr-xr-x104/CH2/EX2.14/2_14.sce18
-rwxr-xr-x104/CH2/EX2.15/2_15.sce5
-rwxr-xr-x104/CH2/EX2.16/2_16.sce15
-rwxr-xr-x104/CH2/EX2.17/2_17.sce17
-rwxr-xr-x104/CH2/EX2.18/2_18.sce9
-rwxr-xr-x104/CH2/EX2.19/2_19.sce9
-rwxr-xr-x104/CH2/EX2.2/2_2.sci4
-rwxr-xr-x104/CH2/EX2.20/2_20.sce13
-rwxr-xr-x104/CH2/EX2.21/2_21.sce6
-rwxr-xr-x104/CH2/EX2.22/2_22.sce5
-rwxr-xr-x104/CH2/EX2.23/2_23.sce8
-rwxr-xr-x104/CH2/EX2.25/2_25.sce6
-rwxr-xr-x104/CH2/EX2.3/2_3.sci9
-rwxr-xr-x104/CH2/EX2.4/2_4.sce7
-rwxr-xr-x104/CH2/EX2.5/2_5.sci7
-rwxr-xr-x104/CH2/EX2.7/2_7.sce11
-rwxr-xr-x104/CH2/EX2.8/2_8.sce14
-rwxr-xr-x104/CH2/EX2.9/2_9.sce12
22 files changed, 192 insertions, 0 deletions
diff --git a/104/CH2/EX2.1/2_1.sce b/104/CH2/EX2.1/2_1.sce
new file mode 100755
index 000000000..731295016
--- /dev/null
+++ b/104/CH2/EX2.1/2_1.sce
@@ -0,0 +1,4 @@
+//laplace transform of unit function
+syms t s
+y=laplace('1',t,s)
+disp(y,"F(s)=") \ No newline at end of file
diff --git a/104/CH2/EX2.10/2_10.sce b/104/CH2/EX2.10/2_10.sce
new file mode 100755
index 000000000..5b4194a66
--- /dev/null
+++ b/104/CH2/EX2.10/2_10.sce
@@ -0,0 +1,4 @@
+//determinant of the matrix
+A=[1 2;3 4]
+d=det(A)
+disp(d) \ No newline at end of file
diff --git a/104/CH2/EX2.12/2_12.sce b/104/CH2/EX2.12/2_12.sce
new file mode 100755
index 000000000..34b4ad49e
--- /dev/null
+++ b/104/CH2/EX2.12/2_12.sce
@@ -0,0 +1,4 @@
+//transpose of a matrix
+A=[3 2 1;0 -1 5]
+t=A'
+disp(t) \ No newline at end of file
diff --git a/104/CH2/EX2.13/2_13.sce b/104/CH2/EX2.13/2_13.sce
new file mode 100755
index 000000000..1fd3d6ab3
--- /dev/null
+++ b/104/CH2/EX2.13/2_13.sce
@@ -0,0 +1,5 @@
+//adjoint of a matrix
+A=[1 2;3 4]
+i=inv(A)
+a=i.*det(A)
+disp(a) \ No newline at end of file
diff --git a/104/CH2/EX2.14/2_14.sce b/104/CH2/EX2.14/2_14.sce
new file mode 100755
index 000000000..0b7693255
--- /dev/null
+++ b/104/CH2/EX2.14/2_14.sce
@@ -0,0 +1,18 @@
+//equality of matrices
+A=[1 2;3 4]
+B=[1 2;3 4]
+x=1;
+for i=1:2
+ for j=1:2
+ if A(i,j)~=B(i,j) then
+ x=0
+ end
+ end
+end
+if x==1 then
+ disp("matrices are equal")
+else
+ disp("matrices are not equal")
+end
+
+ \ No newline at end of file
diff --git a/104/CH2/EX2.15/2_15.sce b/104/CH2/EX2.15/2_15.sce
new file mode 100755
index 000000000..eb0bcd531
--- /dev/null
+++ b/104/CH2/EX2.15/2_15.sce
@@ -0,0 +1,5 @@
+//addition of matrices
+A=[3 2;-1 4;0 -1]
+B=[0 3;-1 2;1 0]
+s=A+B
+disp(s) \ No newline at end of file
diff --git a/104/CH2/EX2.16/2_16.sce b/104/CH2/EX2.16/2_16.sce
new file mode 100755
index 000000000..e9cc75a50
--- /dev/null
+++ b/104/CH2/EX2.16/2_16.sce
@@ -0,0 +1,15 @@
+//conformablility for multiplication of matrices
+A=[1 2 3;4 5 6]
+B=[1 2 3]
+C=size(A)
+D=size(B)
+if C(1,2)==D(1,1) then
+ disp("matrices are conformable for multiplication AB")
+else
+ disp("matrices are not conformable for multiplication AB")
+end
+if D(1,2)==C(1,1) then
+ disp("matrices are conformable for multiplication BA")
+else
+ disp("matrices are not conformable for multiplication BA")
+end
diff --git a/104/CH2/EX2.17/2_17.sce b/104/CH2/EX2.17/2_17.sce
new file mode 100755
index 000000000..581de2719
--- /dev/null
+++ b/104/CH2/EX2.17/2_17.sce
@@ -0,0 +1,17 @@
+//multiplication of matrices
+A=[3 -1;0 1;2 0]
+B=[1 0 -1;2 1 0]
+C=size(A)
+D=size(B)
+if C(1,2)==D(1,1) then
+ AB=A*B
+ disp(AB,"AB=")
+else
+ disp("matrices are not conformable for multiplication AB")
+end
+if D(1,2)==C(1,1) then
+ BA=B*A
+ disp(BA,"BA=")
+else
+ disp("matrices are not conformable for multiplication BA")
+end
diff --git a/104/CH2/EX2.18/2_18.sce b/104/CH2/EX2.18/2_18.sce
new file mode 100755
index 000000000..46dccf01b
--- /dev/null
+++ b/104/CH2/EX2.18/2_18.sce
@@ -0,0 +1,9 @@
+//inverse of 2 X 2 matrix
+A=[1 2;3 4]
+d=det(A)
+if det(A)~=0 then
+ i=inv(A)
+ disp(i,"A^-1=")
+else
+ disp("inverse of a singular matrix doesnt exist")
+end \ No newline at end of file
diff --git a/104/CH2/EX2.19/2_19.sce b/104/CH2/EX2.19/2_19.sce
new file mode 100755
index 000000000..8688ff81e
--- /dev/null
+++ b/104/CH2/EX2.19/2_19.sce
@@ -0,0 +1,9 @@
+//inverse of a 3 X 3 matrix
+A=[1 2 3;4 5 6;7 8 9]
+d=det(A)
+if det(A)~=0 then
+ i=inv(A)
+ disp(i,"A^-1=")
+else
+ disp("inverse of a singular matrix doesnt exist")
+end \ No newline at end of file
diff --git a/104/CH2/EX2.2/2_2.sci b/104/CH2/EX2.2/2_2.sci
new file mode 100755
index 000000000..431e3dd8c
--- /dev/null
+++ b/104/CH2/EX2.2/2_2.sci
@@ -0,0 +1,4 @@
+//laplace transform of exponential function
+ syms t s;
+ y=laplace('%e^(-1*t)',t,s);
+ disp(y,"ans=")
diff --git a/104/CH2/EX2.20/2_20.sce b/104/CH2/EX2.20/2_20.sce
new file mode 100755
index 000000000..19237ce2c
--- /dev/null
+++ b/104/CH2/EX2.20/2_20.sce
@@ -0,0 +1,13 @@
+//rank of a matrix
+A=[0 1;0 1]
+[E,Q,Z ,stair ,rk1]=ereduc(A,1.d-15)
+disp(rk1,"rank of A=")
+B=[0 5 1 4;3 0 3 2]
+[E,Q,Z ,stair ,rk2]=ereduc(B,1.d-15)
+disp(rk2,"rank of B=")
+C=[3 9 2;1 3 0;2 6 1]
+[E,Q,Z ,stair ,rk3]=ereduc(C,1.d-15)
+disp(rk3,"rank of C=")
+D=[3 0 0;1 2 0;0 0 1]
+[E,Q,Z ,stair ,rk4]=ereduc(D,1.d-15)
+disp(rk4,"rank of D=") \ No newline at end of file
diff --git a/104/CH2/EX2.21/2_21.sce b/104/CH2/EX2.21/2_21.sce
new file mode 100755
index 000000000..32165c157
--- /dev/null
+++ b/104/CH2/EX2.21/2_21.sce
@@ -0,0 +1,6 @@
+//z transform
+syms n z;
+a=1;
+x =%e^-(a*n);
+X = symsum(x*(z^(-n)),n,0,%inf)
+disp(X,"ans=") \ No newline at end of file
diff --git a/104/CH2/EX2.22/2_22.sce b/104/CH2/EX2.22/2_22.sce
new file mode 100755
index 000000000..c6c8177c1
--- /dev/null
+++ b/104/CH2/EX2.22/2_22.sce
@@ -0,0 +1,5 @@
+//z transform
+syms n z;
+x =1;
+X = symsum(x*(z^(-n)),n,0,%inf)
+disp(X,"ans=") \ No newline at end of file
diff --git a/104/CH2/EX2.23/2_23.sce b/104/CH2/EX2.23/2_23.sce
new file mode 100755
index 000000000..744e49876
--- /dev/null
+++ b/104/CH2/EX2.23/2_23.sce
@@ -0,0 +1,8 @@
+//z transform
+//t=k*T
+syms k z;
+a=1;
+T=1;
+x =%e^-(a*k*T);
+X = symsum(x*(z^(-k)),k,0,%inf)
+disp(X,"ans=") \ No newline at end of file
diff --git a/104/CH2/EX2.25/2_25.sce b/104/CH2/EX2.25/2_25.sce
new file mode 100755
index 000000000..34c172423
--- /dev/null
+++ b/104/CH2/EX2.25/2_25.sce
@@ -0,0 +1,6 @@
+//final value thereom
+z=%z
+sys=syslin('c',0.792*z^2/((z-1)*(z^2-0.416*z+0.208)))
+syms z
+l=limit(sys*(1-z^-1),z,1)
+disp(l,"limit as k approaches infinity=") \ No newline at end of file
diff --git a/104/CH2/EX2.3/2_3.sci b/104/CH2/EX2.3/2_3.sci
new file mode 100755
index 000000000..fb8e908d3
--- /dev/null
+++ b/104/CH2/EX2.3/2_3.sci
@@ -0,0 +1,9 @@
+//final value thereom
+syms s
+d=poly([0 2 1 1],'s','coeff')
+n=poly([5],'s','coeff')
+f=n/d;
+disp(f,"F(s)=")
+x=s*f;
+y=limit(x,s,0); // final value theorem
+disp(y,"f(inf)=")
diff --git a/104/CH2/EX2.4/2_4.sce b/104/CH2/EX2.4/2_4.sce
new file mode 100755
index 000000000..31017be17
--- /dev/null
+++ b/104/CH2/EX2.4/2_4.sce
@@ -0,0 +1,7 @@
+//inverse laplace
+syms s
+F=1/(s^2+1) //w=1
+disp(F,"F(s)=")
+f=ilaplace(F)
+disp(f,"f(t)=")
+printf("since s*F(s) has two poles on imaginary axis of s plane,final value thereom cannot be applied in this case") \ No newline at end of file
diff --git a/104/CH2/EX2.5/2_5.sci b/104/CH2/EX2.5/2_5.sci
new file mode 100755
index 000000000..f103adeaf
--- /dev/null
+++ b/104/CH2/EX2.5/2_5.sci
@@ -0,0 +1,7 @@
+//partial fractions
+n=poly([3 5],'s','coeff')
+d=poly([6 11 6 1],'s','coeff')
+f=n/d;
+disp(f,"F(s)=")
+pf=pfss(f)
+disp(pf) \ No newline at end of file
diff --git a/104/CH2/EX2.7/2_7.sce b/104/CH2/EX2.7/2_7.sce
new file mode 100755
index 000000000..1e9dc1a1b
--- /dev/null
+++ b/104/CH2/EX2.7/2_7.sce
@@ -0,0 +1,11 @@
+//inverse laplace transform
+n=poly([4],'s','coeff')
+d=poly([4 8 1],'s','coeff') //w=2,damping ratio=2
+G=n/d;
+disp(G,"G(s)=")
+pf=pfss(G)
+disp(pf,"G(s)=")
+syms s t
+g1=ilaplace(pf(1),s,t)
+g2=ilaplace(pf(2),s,t)
+disp(g1+g2,"g(t)=")
diff --git a/104/CH2/EX2.8/2_8.sce b/104/CH2/EX2.8/2_8.sce
new file mode 100755
index 000000000..dfcdab466
--- /dev/null
+++ b/104/CH2/EX2.8/2_8.sce
@@ -0,0 +1,14 @@
+//inverse laplace transform
+n=poly([5 -1 -1],'s','coeff')
+d=poly([0 -1 -2],'s','roots')
+Y=n/d;
+disp(Y,"Y(s)=")
+pf=pfss(Y)
+disp(pf,"Y(s)=")
+syms s t
+y1=ilaplace(pf(1),s,t)
+y2=ilaplace(pf(2),s,t)
+y3=ilaplace(pf(3),s,t)
+disp(y1+y2+y3,"g(t)=")
+l=limit(Y*s,s,0)
+disp(l,"limit of y(t) as t tends to infinity=") \ No newline at end of file
diff --git a/104/CH2/EX2.9/2_9.sce b/104/CH2/EX2.9/2_9.sce
new file mode 100755
index 000000000..863da1f08
--- /dev/null
+++ b/104/CH2/EX2.9/2_9.sce
@@ -0,0 +1,12 @@
+//inverse laplace transform
+n=poly([1000],'s','coeff')
+d=poly([0 1000 34.5 1],'s','coeff')
+Y=n/d;
+disp(Y,"Y(s)=")
+pf=pfss(Y)
+disp(pf,"Y(s)=")
+syms s t
+y1=ilaplace(pf(1),s,t)
+y2=ilaplace(pf(2),s,t)
+y3=ilaplace(pf(3),s,t)
+disp(y1+y2+y3,"y(t)=")