summaryrefslogtreecommitdiff
path: root/275
diff options
context:
space:
mode:
Diffstat (limited to '275')
-rwxr-xr-x275/CH2/EX2.2.55/Ch2_2_55.sce64
-rwxr-xr-x275/CH2/EX2.2.58/Ch2_2_58.sce61
-rwxr-xr-x275/CH3/EX3.3.55/Ch3_3_55.sce44
-rwxr-xr-x275/CH3/EX3.3.72/Ch3_3_72.sce66
-rwxr-xr-x275/CH3/EX3.3.73/Ch3_3_73.sce76
-rwxr-xr-x275/CH3/EX3.3.74/Ch3_3_74.sce74
-rwxr-xr-x275/CH4/EX4.4.49/Ch4_4_49.sce32
-rwxr-xr-x275/CH6/EX6.6.28/Ch6_6_28.sce30
-rwxr-xr-x275/CH8/EX8.8.21/Ch8_8_21.sce363
9 files changed, 404 insertions, 406 deletions
diff --git a/275/CH2/EX2.2.55/Ch2_2_55.sce b/275/CH2/EX2.2.55/Ch2_2_55.sce
index 7016f9cdd..c22cd72f2 100755
--- a/275/CH2/EX2.2.55/Ch2_2_55.sce
+++ b/275/CH2/EX2.2.55/Ch2_2_55.sce
@@ -1,32 +1,32 @@
-clc
-disp("Example 2.55")
-printf("\n")
-disp("Design a zener diode voltage regulator to meet following specification")
-printf("Given\n")
-printf("1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n")
-//unregulated dc input voltage
-Vimin=13
-Vimax=17
-//Load current
-ILmin-0
-ILmax=10*10^-3
-//regulated output voltage
-Vo=10
-//minimum zener current
-Izmin=5*10^-3
-//Maximum power dissipation
-Pzmax=500*10^-3
-//maximum zener current
-Izmax=Pzmax/Vo
-//maximum Resistance
-Rmax=(Vimin-Vo)/(Izmin+ILmax)
-//minimum resistance
-Rmin=(Vimax-Vo)/(Izmax+ILmin)
-//Required resistance
-R=(Rmax+Rmin)/2
-//load resistance
-RLmin=Vo/ILmax
-printf("minimum resistance %d ohm \n",Rmin)
-printf("maximum resistance %d ohm \n",Rmax)
-printf("required resistance %d ohm \n",R)
-printf("load resistance %d ohm \n",RLmin)
+clc
+disp("Example 2.55")
+printf("\n")
+disp("Design a zener diode voltage regulator to meet following specification")
+printf("Given\n")
+printf("1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n")
+//unregulated dc input voltage
+Vimin=13
+Vimax=17
+//Load current
+ILmin=0
+ILmax=10*10^-3
+//regulated output voltage
+Vo=10
+//minimum zener current
+Izmin=5*10^-3
+//Maximum power dissipation
+Pzmax=500*10^-3
+//maximum zener current
+Izmax=Pzmax/Vo
+//maximum Resistance
+Rmax=(Vimin-Vo)/(Izmin+ILmax)
+//minimum resistance
+Rmin=(Vimax-Vo)/(Izmax+ILmin)
+//Required resistance
+R=(Rmax+Rmin)/2
+//load resistance
+RLmin=Vo/ILmax
+printf("minimum resistance %d ohm \n",Rmin)
+printf("maximum resistance %d ohm \n",Rmax)
+printf("required resistance %d ohm \n",R)
+printf("load resistance %d ohm \n",RLmin) \ No newline at end of file
diff --git a/275/CH2/EX2.2.58/Ch2_2_58.sce b/275/CH2/EX2.2.58/Ch2_2_58.sce
index 3c4b2986f..f56f86001 100755
--- a/275/CH2/EX2.2.58/Ch2_2_58.sce
+++ b/275/CH2/EX2.2.58/Ch2_2_58.sce
@@ -1,31 +1,30 @@
-clc
-disp("Example 2.58")
-printf("\n")
-disp("Design a voltage regulator using zener diode to meet following specification")
-printf("Given\n")
-printf("1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n")
-//unregulated dc input voltage
-Vimin=20
-Vimax=30
-//regulated dc output voltage
-Vo=10
-//minimum zener current
-Izmin=2*10^-3
-//maximum zener current
-Izmax=100*10^-3
-//load current
-ILmin=0
-ILmax=25*10^-3
-//load resistance
-RL=Vo/ILmax
-//maximum Resistance
-Rmax=(Vimin-Vo)/(Izmin+ILmax)
-//minimum resistance
-Rmin=(Vimax-Vo)/(Izmax+ILmin)
-//Required resistance
-R=(Rmax+Rmin)/2
-printf("minimum resistance %d ohm \n",Rmin)
-printf("maximum resistance %d ohm \n",Rmax)
-printf("required resistance %d ohm \n",R)
-printf("load resistance %d ohm \n",RLmin)
-
+clc
+disp("Example 2.58")
+printf("\n")
+disp("Design a voltage regulator using zener diode to meet following specification")
+printf("Given\n")
+printf("1 Resistance are in ohms \n 2 Current are in ampere \n 3 voltage sources are in volt\n")
+//unregulated dc input voltage
+Vimin=20
+Vimax=30
+//regulated dc output voltage
+Vo=10
+//minimum zener current
+Izmin=2*10^-3
+//maximum zener current
+Izmax=100*10^-3
+//load current
+ILmin=0
+ILmax=25*10^-3
+//load resistance
+RL=Vo/ILmax
+//maximum Resistance
+Rmax=(Vimin-Vo)/(Izmin+ILmax)
+//minimum resistance
+Rmin=(Vimax-Vo)/(Izmax+ILmin)
+//Required resistance
+R=(Rmax+Rmin)/2
+printf("minimum resistance %d ohm \n",Rmin)
+printf("maximum resistance %d ohm \n",Rmax)
+printf("required resistance %d ohm \n",R)
+printf("load resistance %d ohm \n",RL) \ No newline at end of file
diff --git a/275/CH3/EX3.3.55/Ch3_3_55.sce b/275/CH3/EX3.3.55/Ch3_3_55.sce
index 351c6d536..a5f63195e 100755
--- a/275/CH3/EX3.3.55/Ch3_3_55.sce
+++ b/275/CH3/EX3.3.55/Ch3_3_55.sce
@@ -1,22 +1,22 @@
-clc
-disp("Example 3.55")
-printf("\n")
-disp("Calculate transistor hFE & new Vce level for hFE=100 of base bias ciruit")
-printf("Given\n")
-//given
-Vcc=24
-Rb=390*10^3
-Rc=3.3*10^3
-Vce=10
-//Find Ic
-Ic=(Vcc-Vce)/Rc //from circuit
-//find Ib
-Ib=(Vcc-Vbe)/Rb //from ciruit
-//the value of hFE
-hFE=Ic/Ib
-//to find Vce when hFE=100
-hFE1=100
-Ic1=hFE1*Ib
-Vce1=Vcc-(Ic1*Rc)
-printf("Value of hFE is \n%f\n",hFE)
-printf("New value of Vce is \n%f volt\n",Vce1)
+clc
+disp("Example 3.55")
+printf("\n")
+disp("Calculate transistor hFE & new Vce level for hFE=100 of base bias ciruit")
+printf("Given\n")
+//given
+Vcc=24
+Rb=390*10^3
+Rc=3.3*10^3
+Vce=10
+//Find Ic
+Ic=(Vcc-Vce)/Rc //from circuit
+//find Ib
+Ib=(Vcc-Vce)/Rb //from ciruit
+//the value of hFE
+hFE=Ic/Ib
+//to find Vce when hFE=100
+hFE1=100
+Ic1=hFE1*Ib
+Vce1=Vcc-(Ic1*Rc)
+printf("Value of hFE is \n%f\n",hFE)
+printf("New value of Vce is \n%f volt\n",Vce1) \ No newline at end of file
diff --git a/275/CH3/EX3.3.72/Ch3_3_72.sce b/275/CH3/EX3.3.72/Ch3_3_72.sce
index 9b7b82e98..08b7c9129 100755
--- a/275/CH3/EX3.3.72/Ch3_3_72.sce
+++ b/275/CH3/EX3.3.72/Ch3_3_72.sce
@@ -1,33 +1,33 @@
-clc
-disp("Example 3.72")
-printf("\n")
-disp("Draw a DC load line for Voltage divider circuit")
-printf("Given\n")
-//given
-Vcc=15
-Rc=2.7*10^3
-Re=2.2*10^3
-R1=22*10^3
-R2=12*10^3
-Vbe=0.7
-//base voltage
-Vb=(Vcc*R2)/(R1+R2)
-//emitter voltage
-Ve=Vb-Vbe
-//emitter current
-Ie=Ve/Re
-//collector current
-Icq=Ie
-//collector to emitter voltage
-Vceq=Vcc-(Icq*(Rc+Re))
-//collector voltage
-Vc=Vce+Ve
-//to draw DC load line
-Ic1=Vcc/(Rc+Re)
-Vce=[Vcc Vceq 0]
-Ic=[0 Icq Ic1]
-printf("Q(%f volt,%f ampere)\n",Vceq,Icq)
-plot2d(Vce, Ic)
-xlabel("Vce in volt")
-ylabel("Ic in ampere")
-xtitle("DC load line for base bias circuit")
+clc
+disp("Example 3.72")
+printf("\n")
+disp("Draw a DC load line for Voltage divider circuit")
+printf("Given\n")
+//given
+Vcc=15
+Rc=2.7*10^3
+Re=2.2*10^3
+R1=22*10^3
+R2=12*10^3
+Vbe=0.7
+//base voltage
+Vb=(Vcc*R2)/(R1+R2)
+//emitter voltage
+Ve=Vb-Vbe
+//emitter current
+Ie=Ve/Re
+//collector current
+Icq=Ie
+//collector to emitter voltage
+Vceq=Vcc-(Icq*(Rc+Re));
+Vce=[Vcc Vceq 0];
+//collector voltage
+Vc=Vce+Ve
+//to draw DC load line
+Ic1=Vcc/(Rc+Re)
+Ic=[0 Icq Ic1]
+printf("Q(%f volt,%f ampere)\n",Vceq,Icq)
+plot2d(Vce, Ic)
+xlabel("Vce in volt")
+ylabel("Ic in ampere")
+xtitle("DC load line for base bias circuit") \ No newline at end of file
diff --git a/275/CH3/EX3.3.73/Ch3_3_73.sce b/275/CH3/EX3.3.73/Ch3_3_73.sce
index 1b299caa6..c2a961817 100755
--- a/275/CH3/EX3.3.73/Ch3_3_73.sce
+++ b/275/CH3/EX3.3.73/Ch3_3_73.sce
@@ -1,38 +1,38 @@
-clc
-disp("Example 3.73")
-printf("\n")
-disp("Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit")
-printf("Given\n")
-//given
-Vcc=18
-Vbe=0.7
-hFE=50
-R1=33*10^3
-R2=12*10^3
-Rc=1.2*10^3
-Re=10^3
-//thevenin voltage
-Vt=(Vcc*R2)/(R1+R2)
-//thevenin resistance
-Rt=(R1*R2)/(R1+R2)
-//base current
-Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)
-//collector current
-Icq=hFE*Ib
-//emitter current
-Ie=Ib+Icq
-//emitter voltage
-Ve=Ie*Re
-//collector to emitter voltage
-Vceq=Vcc-(Icq*Rc)-(Ie*Re)
-//collector voltage
-Vc=Vce+Ve
-//to draw DC load line
-Ic1=Vcc/(Rc+Re)
-Vce=[Vcc Vceq 0]
-Ic=[0 Icq Ic1]
-printf("Q(%f volt,%f ampere)\n",Vceq,Icq)
-plot2d(Vce, Ic)
-xlabel("Vce in volt")
-ylabel("Ic in ampere")
-xtitle("DC load line for base bias circuit")
+clc
+disp("Example 3.73")
+printf("\n")
+disp("Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit")
+printf("Given\n")
+//given
+Vcc=18
+Vbe=0.7
+hFE=50
+R1=33*10^3
+R2=12*10^3
+Rc=1.2*10^3
+Re=10^3
+//thevenin voltage
+Vt=(Vcc*R2)/(R1+R2)
+//thevenin resistance
+Rt=(R1*R2)/(R1+R2)
+//base current
+Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)
+//collector current
+Icq=hFE*Ib
+//emitter current
+Ie=Ib+Icq
+//emitter voltage
+Ve=Ie*Re
+//collector to emitter voltage
+Vceq=Vcc-(Icq*Rc)-(Ie*Re);
+Vce=[Vcc Vceq 0];
+//collector voltage
+Vc=Vce+Ve
+//to draw DC load line
+Ic1=Vcc/(Rc+Re)
+Ic=[0 Icq Ic1]
+printf("Q(%f volt,%f ampere)\n",Vceq,Icq)
+plot2d(Vce, Ic)
+xlabel("Vce in volt")
+ylabel("Ic in ampere")
+xtitle("DC load line for base bias circuit") \ No newline at end of file
diff --git a/275/CH3/EX3.3.74/Ch3_3_74.sce b/275/CH3/EX3.3.74/Ch3_3_74.sce
index a34f72ed9..14d3180c5 100755
--- a/275/CH3/EX3.3.74/Ch3_3_74.sce
+++ b/275/CH3/EX3.3.74/Ch3_3_74.sce
@@ -1,38 +1,38 @@
-clc
-disp("Example 3.74")
-printf("\n")
-disp("Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit")
-printf("Given\n")
-//given
-Vcc=15
-Vbe=0.7
-hFE=50
-R1=6.8*10^3
-R2=3.3*10^3
-Rc=0.9*10^3
-Re=0.9*10^3
-//thevenin voltage
-Vt=(Vcc*R2)/(R1+R2)
-//thevenin resistance
-Rt=(R1*R2)/(R1+R2)
-//base current
-Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)
-//collector current
-Icq=hFE*Ib
-//emitter current
-Ie=Ib+Icq
-//emitter voltage
-Ve=Ie*Re
-//collector to emitter voltage
-Vceq=Vcc-(Icq*Rc)-(Ie*Re)
-//collector voltage
-Vc=Vce+Ve
-//to draw DC load line
-Ic1=Vcc/(Rc+Re)
-Vce=[Vcc Vceq 0]
-Ic=[0 Icq Ic1]
-printf("Q(%f,%f)\n",Vceq,Icq)
-plot2d(Vce, Ic)
-xlabel("Vce")
-ylabel("Ic")
+clc
+disp("Example 3.74")
+printf("\n")
+disp("Find the Ve, Ic,Vce & Vc. Draw a DC load line for Voltage divider circuit")
+printf("Given\n")
+//given
+Vcc=15
+Vbe=0.7
+hFE=50
+R1=6.8*10^3
+R2=3.3*10^3
+Rc=0.9*10^3
+Re=0.9*10^3
+//thevenin voltage
+Vt=(Vcc*R2)/(R1+R2)
+//thevenin resistance
+Rt=(R1*R2)/(R1+R2)
+//base current
+Ib=(Vt-Vbe)/(Rt+(1+hFE)*Re)
+//collector current
+Icq=hFE*Ib
+//emitter current
+Ie=Ib+Icq
+//emitter voltage
+Ve=Ie*Re
+//collector to emitter voltage
+Vceq=Vcc-(Icq*Rc)-(Ie*Re);
+Vce=[Vcc Vceq 0];
+//collector voltage
+Vc=Vce+Ve
+//to draw DC load line
+Ic1=Vcc/(Rc+Re)
+Ic=[0 Icq Ic1]
+printf("Q(%f,%f)\n",Vceq,Icq)
+plot2d(Vce, Ic)
+xlabel("Vce")
+ylabel("Ic")
xtitle("DC load line for base bias circuit") \ No newline at end of file
diff --git a/275/CH4/EX4.4.49/Ch4_4_49.sce b/275/CH4/EX4.4.49/Ch4_4_49.sce
index ad4489e25..f843e183d 100755
--- a/275/CH4/EX4.4.49/Ch4_4_49.sce
+++ b/275/CH4/EX4.4.49/Ch4_4_49.sce
@@ -1,16 +1,16 @@
-clc
-disp("Example 4.49")
-printf("\n")
-disp("Determine the minimum & maximum triggering voltage for a UJT")
-printf("Given\n")
-Vbb=20
-//intrinsic ratios
-nmin=0.6
-nmax=0.8
-V=0.7
-//minimum triggering voltage is
-Vpmini=nmin*Vbb+Vd
-//maximum triggering voltage is
-Vpmax=nmax*Vbb+Vd
-printf("Minimum triggering Voltage \n%f volt\n",Vpmini)
-printf("Maximum triggering Voltage \n%f volt\n",Vpmax)
+clc
+disp("Example 4.49")
+printf("\n")
+disp("Determine the minimum & maximum triggering voltage for a UJT")
+printf("Given\n")
+Vbb=20
+//intrinsic ratios
+nmin=0.6
+nmax=0.8
+Vd=0.7
+//minimum triggering voltage is
+Vpmini=nmin*Vbb+Vd
+//maximum triggering voltage is
+Vpmax=nmax*Vbb+Vd
+printf("Minimum triggering Voltage \n%f volt\n",Vpmini)
+printf("Maximum triggering Voltage \n%f volt\n",Vpmax) \ No newline at end of file
diff --git a/275/CH6/EX6.6.28/Ch6_6_28.sce b/275/CH6/EX6.6.28/Ch6_6_28.sce
index f182a6bf6..43b7ade49 100755
--- a/275/CH6/EX6.6.28/Ch6_6_28.sce
+++ b/275/CH6/EX6.6.28/Ch6_6_28.sce
@@ -1,15 +1,15 @@
-clc
-disp("Example 6.27")
-printf("\n")
-disp("Calculate closed loop gain & input voltage to get output voltage 2v")
-print("given")
-disp("Rf=1M,R1=20K,output voltage=2V")
-Rf=10^6
-R1=20*10^3
-Vo=2
-//calculate closed loop gain
-Af=(-Rf/R1)
-//calculate input voltage
-Vi=Vo/Af
-printf("closed loop voltage gain=%f\n",Af)
-printf("Input voltage=%f",Vi)
+clc
+disp("Example 6.28")
+printf("\n")
+disp("Calculate closed loop gain & input voltage to get output voltage 2v")
+printf("given")
+disp("Rf=1M,R1=20K,output voltage=2V")
+Rf=10^6
+R1=20*10^3
+Vo=2
+//calculate closed loop gain
+Af=(-Rf/R1)
+//calculate input voltage
+Vi=Vo/Af
+printf("closed loop voltage gain=%f\n",Af)
+printf("Input voltage=%f",Vi) \ No newline at end of file
diff --git a/275/CH8/EX8.8.21/Ch8_8_21.sce b/275/CH8/EX8.8.21/Ch8_8_21.sce
index 53a3b7837..2c73f7a3a 100755
--- a/275/CH8/EX8.8.21/Ch8_8_21.sce
+++ b/275/CH8/EX8.8.21/Ch8_8_21.sce
@@ -1,182 +1,181 @@
-kclc
-clear
-disp("Example 8.21")
-printf("\n")
-disp("Add the following binary numbers")
-disp("a)11011 & 10110 b)1100 & 111 c)10.1011 & 11.011")
-//Given binary number
-i=1;w=1
-a=11011
-b=10110
-//Given binary number
-i=1;w=1
-bin=11.101
-//separating integer part
-IPa=floor(a)
-IP1a=IPa
-//separating decimal part
-DPa=modulo(a,1)
-DP1a=DPa
-//converting decimal value to interger
-p=4
-DPa=DPa*10^p //should change power of 10 as according to number of digits in decimal digit
-
-//storing each integer digit in I(i)
-while(IPa>0)
- Ia(i)=modulo(IPa,10);
- IPa=floor(IPa/10);
- i=i+1;
- end
-//storing each decimal digit in D(w)
-while(DPa>0)
- Da(w)=modulo(DPa,2)
- DPa=(DPa/10)
- DPa=floor(DPa)
- w=w+1;
- end
- //to do zero padding of remaining erm of D(w)
- if(DP1a<1)
- if(DP1a>0)
-if(length(Da)<p)
- q=length(Da)
- for f=q+1 :p
- Da(f)=0
- end
- end
-end
-end
-
-if(IP1a>0)
-for i=1:length(Ia)//checking whether it is a binary number or not
- if(Ia(i)>1) then
- disp('not a binary number')
- abort
- end
- end
-end
-if(IP1a>0)
-IPa=0
-for i=1:length(Ia)
-//multipliying bits of integer part with their position values and adding
- IPa=IPa+(Ia(i)*2^(i-1))
- end
- end
- DPa=0
- if(DP1a>0)
- if(DP1a<1)
-for z=1:length(Da)
-//multipliying bits of decimal part with their position values and adding
- DPa=DPa+(Da(z)*2^(-1*(length(Da)+1-z)))
- end
-end
-end
-decimala=IPa+DPa
-//displaying the output
-disp(decimala)
-
-//for b
-//Given binary number
-i=1;w=1
-//separating integer part
-IPb=floor(b)
-IP1b=IPb
-//separating decimal part
-DPb=modulo(b,1)
-DP1b=DPb
-//converting decimal value to interger
-p=3
-DPb=DPb*10^p //should change power of 10 as according to number of digits in decimal digit
-
-//storing each integer digit in I(i)
-while(IPb>0)
- Ib(i)=modulo(IPb,10);
- IPb=floor(IPb/10);
- i=i+1;
- end
-//storing each decimal digit in D(w)
-while(DPb>0)
- Db(w)=modulo(DPb,2)
- DPb=(DPb/10)
- DPb=floor(DPb)
- w=w+1;
- end
- //to do zero padding of remaining erm of D(w)
- if(DP1b>0)
- if(DP1b<1)
-if(length(Db)<p)
- q=length(Db)
- for f=q+1 :p
- Db(f)=0
- end
- end
-end
-end
-if(IP1b>0)
-for i=1:length(Ib)//checking whether it is a binary number or not
- if(Ib(i)>1) then
- disp('not a binary number')
- abort
- end
- end
-end
-if(IP1b>0)
-IPb=0
-for i=1:length(Ib)
-//multipliying bits of integer part with their position values and adding
- IPb=IPb+(Ib(i)*2^(i-1))
- end
- end
-DPb=0
-if(DP1b>0)
- if(DP1b<1)
- for z=1:length(Db)
-//multipliying bits of decimal part with their position values and adding
- DPb=DPb+(Db(z)*2^(-1*(length(Db)+1-z)))
- end
-end
-end
-decimalb=IPb+DPb
-//displaying the output
-disp(decimalb)
-
-sum1=decimala+decimalb
-i=1;x=1
-
-//separating integer part
-IP=floor(sum1)
-IP1=IP
-//separating decimal part
-DP=modulo(sum1,1)
-//storing each integer digit in I(i)
-while(IP>0)
- I(i)=(modulo(floor(IP),2))
- IP=floor(IP)/2
- i=i+1
-end
-if(IP1>0)
-IP=0
-for j=1:length(I)
-//multipliying bits of integer part with their position values and adding
- IP=IP+(I(j)*10^(j-1));
- end
-else
- IP=0
-end
-
-//storing each decimal digit in D(x)
-while(x<=4)
- DP=DP*2
- D(x)=floor(DP)
- x=x+1
- DP=modulo(DP,1)
-end
-
-DP=0
-for j=1:length(D)
-//multipliying bits of decimal part with their position values and adding
- DP=DP+(10^(-1*j)*D(j))
-end
-Binary=IP+DP;
-printf("Sum")
-disp(Binary)
-
+clc
+clear
+disp("Example 8.21")
+printf("\n")
+disp("Add the following binary numbers")
+disp("a)11011 & 10110 b)1100 & 111 c)10.1011 & 11.011")
+//Given binary number
+i=1;w=1
+a=11011
+b=10110
+//Given binary number
+i=1;w=1
+bin=11.101
+//separating integer part
+IPa=floor(a)
+IP1a=IPa
+//separating decimal part
+DPa=modulo(a,1)
+DP1a=DPa
+//converting decimal value to interger
+p=4
+DPa=DPa*10^p //should change power of 10 as according to number of digits in decimal digit
+
+//storing each integer digit in I(i)
+while(IPa>0)
+ Ia(i)=modulo(IPa,10);
+ IPa=floor(IPa/10);
+ i=i+1;
+ end
+//storing each decimal digit in D(w)
+while(DPa>0)
+ Da(w)=modulo(DPa,2)
+ DPa=(DPa/10)
+ DPa=floor(DPa)
+ w=w+1;
+ end
+ //to do zero padding of remaining erm of D(w)
+ if(DP1a<1)
+ if(DP1a>0)
+if(length(Da)<p)
+ q=length(Da)
+ for f=q+1 :p
+ Da(f)=0
+ end
+ end
+end
+end
+
+if(IP1a>0)
+for i=1:length(Ia)//checking whether it is a binary number or not
+ if(Ia(i)>1) then
+ disp('not a binary number')
+ abort
+ end
+ end
+end
+if(IP1a>0)
+IPa=0
+for i=1:length(Ia)
+//multipliying bits of integer part with their position values and adding
+ IPa=IPa+(Ia(i)*2^(i-1))
+ end
+ end
+ DPa=0
+ if(DP1a>0)
+ if(DP1a<1)
+for z=1:length(Da)
+//multipliying bits of decimal part with their position values and adding
+ DPa=DPa+(Da(z)*2^(-1*(length(Da)+1-z)))
+ end
+end
+end
+decimala=IPa+DPa
+//displaying the output
+disp(decimala)
+
+//for b
+//Given binary number
+i=1;w=1
+//separating integer part
+IPb=floor(b)
+IP1b=IPb
+//separating decimal part
+DPb=modulo(b,1)
+DP1b=DPb
+//converting decimal value to interger
+p=3
+DPb=DPb*10^p //should change power of 10 as according to number of digits in decimal digit
+
+//storing each integer digit in I(i)
+while(IPb>0)
+ Ib(i)=modulo(IPb,10);
+ IPb=floor(IPb/10);
+ i=i+1;
+ end
+//storing each decimal digit in D(w)
+while(DPb>0)
+ Db(w)=modulo(DPb,2)
+ DPb=(DPb/10)
+ DPb=floor(DPb)
+ w=w+1;
+ end
+ //to do zero padding of remaining erm of D(w)
+ if(DP1b>0)
+ if(DP1b<1)
+if(length(Db)<p)
+ q=length(Db)
+ for f=q+1 :p
+ Db(f)=0
+ end
+ end
+end
+end
+if(IP1b>0)
+for i=1:length(Ib)//checking whether it is a binary number or not
+ if(Ib(i)>1) then
+ disp('not a binary number')
+ abort
+ end
+ end
+end
+if(IP1b>0)
+IPb=0
+for i=1:length(Ib)
+//multipliying bits of integer part with their position values and adding
+ IPb=IPb+(Ib(i)*2^(i-1))
+ end
+ end
+DPb=0
+if(DP1b>0)
+ if(DP1b<1)
+ for z=1:length(Db)
+//multipliying bits of decimal part with their position values and adding
+ DPb=DPb+(Db(z)*2^(-1*(length(Db)+1-z)))
+ end
+end
+end
+decimalb=IPb+DPb
+//displaying the output
+disp(decimalb)
+
+sum1=decimala+decimalb
+i=1;x=1
+
+//separating integer part
+IP=floor(sum1)
+IP1=IP
+//separating decimal part
+DP=modulo(sum1,1)
+//storing each integer digit in I(i)
+while(IP>0)
+ I(i)=(modulo(floor(IP),2))
+ IP=floor(IP)/2
+ i=i+1
+end
+if(IP1>0)
+IP=0
+for j=1:length(I)
+//multipliying bits of integer part with their position values and adding
+ IP=IP+(I(j)*10^(j-1));
+ end
+else
+ IP=0
+end
+
+//storing each decimal digit in D(x)
+while(x<=4)
+ DP=DP*2
+ D(x)=floor(DP)
+ x=x+1
+ DP=modulo(DP,1)
+end
+
+DP=0
+for j=1:length(D)
+//multipliying bits of decimal part with their position values and adding
+ DP=DP+(10^(-1*j)*D(j))
+end
+Binary=IP+DP;
+printf("Sum")
+disp(Binary) \ No newline at end of file