summaryrefslogtreecommitdiff
path: root/Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb')
-rw-r--r--Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb217
1 files changed, 217 insertions, 0 deletions
diff --git a/Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb b/Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb
new file mode 100644
index 0000000..161f99f
--- /dev/null
+++ b/Basics_of_Electrical_by_Electronics_and_Communication_Engineering/11-Digital_Systems.ipynb
@@ -0,0 +1,217 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 11: Digital Systems"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.12: Binary_to_decimal.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.12\n",
+"clc;clear;close;\n",
+"format('v',5);\n",
+"binary='11010';//given binary value\n",
+"decimal=bin2dec(binary);//equivalent decimal\n",
+"disp(decimal,'Equivalent decimal value is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.13: decimal_to_binary.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.13\n",
+"clc;clear;close;\n",
+"format('v',5);\n",
+"decimal=26;//given decimal value\n",
+"binary=dec2bin(decimal);//equivalent binary value\n",
+"disp(binary,'Equivalent binary value is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.14: decimal_to_binary.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.14\n",
+"clc;clear;close;\n",
+"format('v',9);\n",
+"dec=34.6875;//given decimal value\n",
+"i=floor(dec);//integer part\n",
+"f=dec-i;//fraction part\n",
+"i_bin=dec2bin(i);//binary equivalent of integer part\n",
+"f_bin=' ';//for initializing(string)\n",
+"for n=1:4\n",
+" t=2*f;\n",
+" if t>=1 then\n",
+" p(n)=1;\n",
+" f=t-1;\n",
+" end\n",
+"if t<1 then\n",
+" p(n)=0;\n",
+" f=t;\n",
+"end\n",
+"f_bin=f_bin+string(p(n));//binary equivalent of fraction part\n",
+"end;\n",
+"bin=i_bin+'.'+f_bin;//Binary equivalent of complete no.\n",
+"disp(bin,'Binary equivalent of complete no. is ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.15: Hexadecimal_to_decimal.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.15\n",
+"clc;clear;close;\n",
+"format('v',7);\n",
+"hex='A013';//given hexadecimal value\n",
+"dec=hex2dec(hex);//equivalent decimal value\n",
+"disp(dec,'Equivalent decimal value is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.16: decimal_to_hexadecimal.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.16\n",
+"clc;clear;close;\n",
+"format('v',7);\n",
+"dec=7046;//given decimal value\n",
+"hex=dec2hex(dec);//equivalent hexadecimal value\n",
+"disp(hex,'Equivalent hexadecimal value is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.17: Hexadecimal_to_binary.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.17\n",
+"clc;clear;close;\n",
+"format('v',7);\n",
+"hex='F851';//given hexadecimal value\n",
+"dec=hex2dec(hex);//equivalent decimal value\n",
+"bin=dec2bin(dec);//equivalent binary value\n",
+"disp(bin,'Equivalent binary value is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2.18: Binary_to_hexadecimal.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Part B Ex 2.18\n",
+"clc;clear;close;\n",
+"format('v',7);\n",
+"bin='111011011000100';//given binary value\n",
+"dec=bin2dec(bin);//equivalent decimal value\n",
+"hex=dec2hex(dec);//equivalent hexadecimal value\n",
+"disp(hex,'Equivalent hexadecimal value is');"
+ ]
+ }
+],
+"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
+}