diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /48/CH7 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '48/CH7')
-rwxr-xr-x | 48/CH7/EX7.1/eg_7_1.sce | 45 | ||||
-rwxr-xr-x | 48/CH7/EX7.2/eg_7_2.sce | 53 | ||||
-rwxr-xr-x | 48/CH7/EX7.3/eg_7_3.sce | 6 | ||||
-rwxr-xr-x | 48/CH7/EX7.4/eg_7_4.sce | 5 | ||||
-rwxr-xr-x | 48/CH7/EX7.5/eg_7_5.sce | 22 |
5 files changed, 131 insertions, 0 deletions
diff --git a/48/CH7/EX7.1/eg_7_1.sce b/48/CH7/EX7.1/eg_7_1.sce new file mode 100755 index 000000000..e647740e4 --- /dev/null +++ b/48/CH7/EX7.1/eg_7_1.sce @@ -0,0 +1,45 @@ +clc;
+clear;
+//takes the input and check whether it is valid or not
+x1=input("x1 = ");
+while(x1~=0 & x1~=1)
+ disp("enter a valid logical level");
+ x1=input("x1 = ");
+end
+x2=input("x2 = ");
+while(x2~=0 & x2~=1)
+ disp("enter a valid logical level");
+ x2=input("x = ");
+end
+x3=input("x3 = ");
+while(x3~=0 & x3~=1)
+ disp("enter a valid logical level");
+ x3=input("x3 = ");
+end
+f=-x1+(2*x2)+x3;
+if(f>0.5) then
+ f=1;
+else
+ f=0;
+end
+disp(f,"output y is");
+m=1;
+//displays the output of the above expression for all the combinations of inputs.
+for x=0:1
+ for y=0:1
+ for z=0:1
+ f1(m,1)=x;
+ f1(m,2)=y;
+ f2(m,3)=z;
+ f1(m,4)=-x+(2*y)+z;
+ if(f1(m,4)>0.5) then
+ f1(m,5)=1;
+ else
+ f1(m,5)=0;
+ end
+ m=m+1;
+ end
+ end
+end
+disp(" x1 x2 x3 sum y");
+disp(f1)
diff --git a/48/CH7/EX7.2/eg_7_2.sce b/48/CH7/EX7.2/eg_7_2.sce new file mode 100755 index 000000000..dde6168a1 --- /dev/null +++ b/48/CH7/EX7.2/eg_7_2.sce @@ -0,0 +1,53 @@ +clc;
+clear;
+y='y';
+i=1;
+//Takes the equivalent decimal value of the min terms for eg: x^yz=011=3
+while(y=='y')
+ disp("enter the minterm of a 3 variable function");
+ x(i)=input(": ");
+ while(x(i)>7)
+ disp("enter a valid minterm");
+ end
+ disp("press y if you want to enter more min terms else n :");
+ y=input("");
+ i=i+1;
+end
+a=1;
+//Generating truth table for determining the inequalities
+for i=0:1
+ for j=0:1
+ for k=0:1
+ for z=1:length(x)
+ if(x(z)==a-1);
+ f(a,4)=1;
+ end
+ end
+ f(a,1)=i;
+ f(a,2)=j;
+ f(a,3)=k;
+ a=a+1;
+ end
+ end
+end
+//displaying the truth table
+disp(" x1 x2 x3 f");
+disp(f);
+disp("");
+a=1;
+//generating inequalities
+for i=0:1
+ for j=0:1
+ for k=0:1
+ if(f(a,4)==1)
+ printf('%3d * w1 + %3d * w2 + %3d * w3>=T',f(a,1),f(a,2),f(a,3))
+ disp("")
+ else
+ printf('%3d * w1 + %3d * w2 + %3d * w3<T',f(a,1),f(a,2),f(a,3))
+ disp("")
+ end
+ a=a+1;
+ end
+ end
+end
+disp("By solving the above inequalities we can get the values of weights and T");
\ No newline at end of file diff --git a/48/CH7/EX7.3/eg_7_3.sce b/48/CH7/EX7.3/eg_7_3.sce new file mode 100755 index 000000000..146ba1a76 --- /dev/null +++ b/48/CH7/EX7.3/eg_7_3.sce @@ -0,0 +1,6 @@ +clc;
+clear;
+disp("Given function is f=x1x2^+x2x3^");
+disp("Since x1 has no complemented form in the above function f,f is positive in x1");
+disp("x2 has both complemented and uncomplemented forms in f so f is not unate in x2");
+disp("x3 is only in complemented form so f is negative in x3");
\ No newline at end of file diff --git a/48/CH7/EX7.4/eg_7_4.sce b/48/CH7/EX7.4/eg_7_4.sce new file mode 100755 index 000000000..0d06792bf --- /dev/null +++ b/48/CH7/EX7.4/eg_7_4.sce @@ -0,0 +1,5 @@ +clc; +clear; +disp("given function is f=x1^x2+x2x3^"); +disp("Since the varibles x1 and x3 are only in their complemented form f is negative and unate in x1 and x3"); +disp("even x2 is only in its uncomplemented form so f is positive in x2");
\ No newline at end of file diff --git a/48/CH7/EX7.5/eg_7_5.sce b/48/CH7/EX7.5/eg_7_5.sce new file mode 100755 index 000000000..55fc00da7 --- /dev/null +++ b/48/CH7/EX7.5/eg_7_5.sce @@ -0,0 +1,22 @@ +clc; +clear; +n=input("Enter the no of input variables :"); +//Input the true minimal vertices +v=input("Enter the no of minimal true vertices :"); +disp("vertex will be in the form of 101 if it is 3 variable"); +for i=1:v + printf('Vertex %3d :',i) + s(i)=input(" "); +end +tv=input("enter a vertex which you want find whether true vertex or not"); +//determines whether the vertex is a true or not by comparing it with the true minimal vertices +for i=1:v + if(tv>s(i)) + disp("It is a true vertex"); + break; + else + if(i==v) + disp("It is not a true vertex since it is not > than any of the min vertices"); + end + end +end
\ No newline at end of file |