summaryrefslogtreecommitdiff
path: root/Analog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Analog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb')
-rwxr-xr-xAnalog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb820
1 files changed, 0 insertions, 820 deletions
diff --git a/Analog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb b/Analog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb
deleted file mode 100755
index d917ea6c..00000000
--- a/Analog_and_Digital_Communications_by_H_P_Hsu/CHAPTER05.ipynb
+++ /dev/null
@@ -1,820 +0,0 @@
-{
- "metadata": {
- "name": "",
- "signature": "sha256:d2b10e85dc4e5ecd691f760bb8b2905ecd459bb295630a40b80f0bb469c6ca0a"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER05:PULSE MODULATION"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E09 : Pg 5.26"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.26\n",
- "# Example 5.9\n",
- "# Given,\n",
- "# m(t)=10cos(2000*pi*t)cos(8000*pi*t)\n",
- "# or 5 cos (6000*pi*t) +5*cos(10000*pi*t)\n",
- "# (a) Minimum sampling rate\n",
- "# we have\n",
- "fM=5000.; # Hz\n",
- "fs=2.*fM;\n",
- "print'Minimum sampling rate',fs,'Hz'\n",
- "\n",
- "# (b)bandpass sampling theoram\n",
- "fu=fM;\n",
- "fb=fM-3000.; # Hz\n",
- "# As fu/fb is 2.5\n",
- "# We have\n",
- "k=2.;\n",
- "fs2=(2.*fu)/k;\n",
- "print'Minimum sampling rate by sampling theoram',fs2,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Minimum sampling rate 10000.0 Hz\n",
- "Minimum sampling rate by sampling theoram 5000.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E14 : Pg 5.31"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.31\n",
- "# Example 5.14\n",
- "\n",
- "# Given,\n",
- "Rb=36000.; # (b/s)\n",
- "fM=3200.; # Hz\n",
- "fs=2.*fM;\n",
- "n=Rb/fs;\n",
- "# As n should be less than Rs/fs\n",
- "\n",
- "nn=round(n,2)-1;\n",
- "print'Binary digits',nn\n",
- "\n",
- "L=2**nn;\n",
- "print'Quantizing level',L\n",
- "\n",
- "fs=Rb/nn;\n",
- "print'Sampling Rate',fs,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Binary digits 4.63\n",
- "Quantizing level 24.7610398967\n",
- "Sampling Rate 7775.37796976 Hz\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E15 : Pg 5.31"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.31\n",
- "# Example 5.15\n",
- "mp=1.; # Assume peak amplitude is unity\n",
- "# Given\n",
- "dela=0.02*mp;\n",
- "\n",
- "L=(mp*2)/dela;\n",
- "\n",
- "#for i in range(0,10):\n",
- "# j=2**i;\n",
- "# if(j>=L)\n",
- "# L1=j;\n",
- "# break;\n",
- "import math \n",
- "#n=math.log(L1,2);# bits per sample\n",
- "n=7.;\n",
- "print'Number of bits',n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Number of bits 7.0\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E18 : Pg 5.31"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.31\n",
- "# Example 5.18\n",
- "# Given,\n",
- "import math \n",
- "\n",
- "SbyN=40.; # db\n",
- "SbyN0=10.**(SbyN/10);\n",
- "\n",
- "# As sbyn=3L**2/2\n",
- "L=math.sqrt((2.*(SbyN0))/3.);\n",
- "LL=round(L);\n",
- "\n",
- "n=(math.log(LL))/math.log(2);\n",
- "\n",
- "nn=(round(n))+1; # Upper limit\n",
- "\n",
- "print'Binary digits',nn\n",
- "LL=2.**nn;\n",
- "\n",
- "print'Number of levels',LL\n",
- "# As SQN= 1.76+6.02(n)\n",
- "SQN= 1.76+6.02*(nn);\n",
- "print'Signal to quantizin ratio',SQN,'db'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Binary digits 7.0\n",
- "Number of levels 128.0\n",
- "Signal to quantizin ratio 43.9 db\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E19 : Pg 5.33"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.33\n",
- "# Example 5.19\n",
- "# Given,\n",
- "n=16.;\n",
- "Rb=44100.; # b/s\n",
- "# (a) Output signal to quantizing ratio\n",
- "SNQ=1.76+(6.02*n);\n",
- "print'Output signal to quantizing ratio: ',SNQ,'db'\n",
- "\n",
- "# (b)Input Bit Rate\n",
- "IBR=2.*Rb*n;\n",
- "print'Input bit rate: ',IBR,'B/s'\n",
- "OBR=2.*IBR;\n",
- "print'Output bit rate: ',OBR,'B/s'\n",
- "\n",
- "# (c)Number of bits recorded\n",
- "# Given, an hours time\n",
- "# Therefore, time\n",
- "t=60.*60.;\n",
- "NBR=OBR*t;\n",
- "print'Number of bits recorded: ',NBR,'Bytes'\n",
- "\n",
- "# (d) Dictionary\n",
- "# Given\n",
- "p=1500.;\n",
- "c=2.;\n",
- "l=100.;\n",
- "w=8.;\n",
- "let=6.;\n",
- "b=7.;\n",
- "d=p*c*l*w*let*b;\n",
- "print'Number of bits required',d,'Bytes'\n",
- "\n",
- "x=NBR/(2.*d);\n",
- "y=round(x);\n",
- "print'Number of comparable books',y"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Output signal to quantizing ratio: 98.08 db\n",
- "Input bit rate: 1411200.0 B/s\n",
- "Output bit rate: 2822400.0 B/s\n",
- "Number of bits recorded: 10160640000.0 Bytes\n",
- "Number of bits required 100800000.0 Bytes\n",
- "Number of comparable books 50.0\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E22 : Pg 5.35"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.35\n",
- "# Example 5.22\n",
- "# Given,\n",
- "f1=200.; # Hz\n",
- "f2=3300.; # Hz\n",
- "fs=8000.; # Samples/s\n",
- "SQN=30.; # dB\n",
- "import math \n",
- "# (a)Minimum number of quantizin levels and bits per sample\n",
- "# From SQN=1.76+20log L\n",
- "La=10.**((SQN-1.76)/20.);\n",
- "L=round(La);\n",
- "print'Minimum number of quantizing levels',L\n",
- "n=math.log(L)/math.log(2);\n",
- "nn=round(n);\n",
- "print'Minimum number of bits per sample',nn\n",
- "\n",
- "# (b)Minimum system bandwidth\n",
- "Fpcm=(nn*fs)/2.;\n",
- "print'Minimum system Bandwidth',Fpcm,'Hz'\n",
- "\n",
- "# (c)For u=255\n",
- "# SQN=20logL-10.1\n",
- "La1=10.**((SQN+10.1)/20.);\n",
- "L1=(round(La1))+1.; # Upper Limit\n",
- "print'Minimum number of quantizing levels for u=255',L1\n",
- "n1=math.log(L1)/math.log(2);\n",
- "nn1=(round(n1));\n",
- "print'Minimum number of bits per sample',nn1\n",
- "\n",
- "# Minimum system bandwidth\n",
- "Fpcm1=(nn1*fs)/2.;\n",
- "print'Minimum system Bandwidth',Fpcm1,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Minimum number of quantizing levels 26.0\n",
- "Minimum number of bits per sample 5.0\n",
- "Minimum system Bandwidth 20000.0 Hz\n",
- "Minimum number of quantizing levels for u=255 102.0\n",
- "Minimum number of bits per sample 7.0\n",
- "Minimum system Bandwidth 28000.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E25 : Pg 5.37"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.37\n",
- "# Example 5.25\n",
- "# Given,\n",
- "import math \n",
- "fs=32.*10.**+3.; # Hz\n",
- "fm=1000.; # Hz\n",
- "fM=4.*10.**3.; # Hz\n",
- "# As SNR=(3*(fs**3))/(8*pi*pi*(fm**2)*fM)\n",
- "SNR=(3.*(fs**3.))/(8.*math.pi*math.pi*(fm**2.)*fM);\n",
- "SNRdb=(math.log(SNR))/math.log(10);\n",
- "print'Output SNR',SNRdb,'dB'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Output SNR 2.49312146597 dB\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E26 : Pg 5.38"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.38\n",
- "# Example 5.26\n",
- "# Given,\n",
- "n=4.;\n",
- "SNQ=1.76+(6.02*n);\n",
- "print'Output SNR',SNQ,'dB'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Output SNR 25.84 dB\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E27 : Pg 5.38"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.38\n",
- "# Example 5.27\n",
- "import math \n",
- "# Given,\n",
- "bw=3.*10.**3.; # Hz\n",
- "n=3.;\n",
- "fs=(n*2.*bw);\n",
- "dela=250.*10.**3; # mV\n",
- "fm=1000.; # Hz\n",
- "# (a) Maximum amplitude\n",
- "Amax=(dela*fs)/(2.*math.pi*fm);\n",
- "print'Maximum Amplitude',Amax,'V'\n",
- "\n",
- "# (b) Output signal to quantizing ratio\n",
- "SNRO=(3.*(fs**3.))/(8.*math.pi*math.pi*(fm**3.));\n",
- "SNRdb=10.*(math.log(SNRO))/math.log(10);\n",
- "print'Output SNR',SNRdb,'dB'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Maximum Amplitude 716197.243914 V\n",
- "Output SNR 23.4554903765 dB\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E32 : Pg 5.40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.40\n",
- "# Example 5.32\n",
- "# Given,\n",
- "m1=3.*10.**3.; # Hz\n",
- "m2=3.5*10.**3.; # Hz\n",
- "# Since highest frequency is of m2\n",
- "Sr=2.*m2; \n",
- "print'Sampling Rate',Sr,'Samples/s'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sampling Rate 7000.0 Samples/s\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E33 : Pg 5.40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.40\n",
- "# Example 5.33\n",
- "# Given,\n",
- "import math \n",
- "m1=3.6*10.**3.; # Hz\n",
- "m2=1.2*10.**3.; # Hz\n",
- "m3=m2;\n",
- "m4=m2;\n",
- "# (a)Nyquist rate\n",
- "nr1=2.*m1;\n",
- "print'Nyquist Rate of m1(t)',nr1\n",
- "nr2=2.*m2;\n",
- "print'Nyquist Rate of m2(t)',nr2\n",
- "nr3=2.*m3;\n",
- "print'Nyquist Rate of m3(t)',nr3\n",
- "nr4=2.*m4;\n",
- "print'Nyquist Rate of m4(t)',nr4\n",
- "\n",
- "# (b) Speed of commutator\n",
- "c=nr1+nr2+nr3+nr4;\n",
- "print'Speed of commutator',c,'samples/s'\n",
- "\n",
- "# (c)Output bit rate\n",
- "# Given, \n",
- "L=1024.;\n",
- "n=math.log(L)/math.log(2);\n",
- "OBR=n*c;\n",
- "print'Output bit rate',OBR,'b/s'\n",
- "\n",
- "# (d)Minimum channel bandwidth\n",
- "fB=c/2.;\n",
- "print'Minimum Channel Bandwidth',fB,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Nyquist Rate of m1(t) 7200.0\n",
- "Nyquist Rate of m2(t) 2400.0\n",
- "Nyquist Rate of m3(t) 2400.0\n",
- "Nyquist Rate of m4(t) 2400.0\n",
- "Speed of commutator 14400.0 samples/s\n",
- "Output bit rate 144000.0 b/s\n",
- "Minimum Channel Bandwidth 7200.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E34 : Pg 5.41"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.41\n",
- "# Example 5.34\n",
- "\n",
- "# Given,\n",
- "fs=8000.; # Hz\n",
- "m=24.;\n",
- "n=8.;\n",
- "# (a) Duration of each bit\n",
- "t1=1./fs;\n",
- "t2=(m*n)+1.; # Extra bit for synchronization\n",
- "Tb=t1/t2;\n",
- "print'Duration of each bit',Tb,'seconds'\n",
- "\n",
- "# (b) Transmission Rate\n",
- "Rb=1./Tb;\n",
- "print'Transmission Rate',Rb,'b/s'\n",
- "\n",
- "# (c)Minimum transmission bandwidth\n",
- "fT1=1./(2.*Tb);\n",
- "print'Minimum transmission bandwidth',fT1,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Duration of each bit 6.47668393782e-07 seconds\n",
- "Transmission Rate 1544000.0 b/s\n",
- "Minimum transmission bandwidth 772000.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E35 : Pg 5.42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.42\n",
- "# Example 5.35\n",
- "# Given,\n",
- "n=24.;\n",
- "f=3.4*10.**3; # Hz\n",
- "ts=1.*10**6.; # Second\n",
- "# (a) Spacing between succesive multiplexed pulses\n",
- "fs=8000.; # Samples per second\n",
- "t1=1./fs;\n",
- "t2=n+1.; # One synchronizing bit\n",
- "Tb=t1/t2;\n",
- "# Actual Tb, as actual duration of each pulse is 1us\n",
- "ATb=Tb-ts;\n",
- "print'Spacing between succesive multiplexed pulses',ATb,'Seconds'\n",
- "# (b) Nyquist Rate of Sampling\n",
- "f1=2.*f;\n",
- "T=1./f1; # Seconds\n",
- "Tb1=T/t2;\n",
- "ATb1=Tb1-ts;\n",
- "print'Spacing between succesive multiplexed pulses using Nyquist rate of sampling',ATb1,'Seconds'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Spacing between succesive multiplexed pulses -999999.999995 Seconds\n",
- "Spacing between succesive multiplexed pulses using Nyquist rate of sampling -999999.999994 Seconds\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E37 : Pg 5.43"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.43\n",
- "# Example 5.37\n",
- "# Given,\n",
- "bw=3.5*10.**3.; # Hz\n",
- "# Roll off factor\n",
- "a=0.25;\n",
- "Rb=(2.*bw)/(1.+a);\n",
- "print'Data Rate',Rb,'b/s'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Data Rate 5600.0 b/s\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E38 : Pg 5.43"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.43\n",
- "# Example 5.38\n",
- "# Given,\n",
- "fB=75.*10.**3.; # Hz\n",
- "Rb=0.1*10.**6.; # B/s\n",
- "Tb=1./Rb;\n",
- "a=(2.*fB*Tb)-1.;\n",
- "print'Roll off factor',a"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Roll off factor 0.5\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E39 : Pg 5.43"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.43\n",
- "# Example 5.39\n",
- "# Given,\n",
- "import math \n",
- "m=8.;\n",
- "fM=2.*10.**3.; # Hz\n",
- "a=0.2;\n",
- "# Here we choose L=128;\n",
- "L=128.;\n",
- "n=math.log(L)/math.log(2);\n",
- "Sr=2.*fM;\n",
- "fs=1.25*Sr;\n",
- "\n",
- "# For n tdm signals\n",
- "x=m*fs;\n",
- "\n",
- "# Resultant bit rate\n",
- "br=7.*x;\n",
- "\n",
- "# Minimum Transmission bandwidth\n",
- "fB=((1.+a)*br)/2.;\n",
- "print'Minimum Transmission bandwidth',fB,'Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Minimum Transmission bandwidth 168000.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example E40 : Pg 5.44"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Page Number: 5.44\n",
- "# Example 5.40\n",
- "# Given,\n",
- "import math \n",
- "M=16.;\n",
- "sr=40000.;\n",
- "a=0.3;\n",
- "# (a) Bit Rate\n",
- "n=math.log(M)/math.log(2);\n",
- "br=sr*n;\n",
- "print'Bit Rate: ',br,'b/s'\n",
- "\n",
- "# (b)\n",
- "# As 2*fB=(1+a)*R/log2M\n",
- "# Given \n",
- "bw=110.*10.**3.; # Hz # =2*fB\n",
- "\n",
- "M=2.**(((1.+a)*br)/bw);\n",
- "MM=round(M);\n",
- "print'Value of M',MM\n",
- "\n",
- "# (c)Band Rate\n",
- "band=br/(math.log(n))/math.log(2);\n",
- "print'Band Rate',band,'Symbols/s'\n",
- "\n",
- "# (d) Spectral efficiency\n",
- "BT=((1.+a)*br)/2.;\n",
- "Eff=br/BT;\n",
- "print'Spectral efficiency',Eff,'b/s Hz'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Bit Rate: 160000.0 b/s\n",
- "Value of M 4.0\n",
- "Band Rate 166509.51848 Symbols/s\n",
- "Spectral efficiency 1.53846153846 b/s Hz\n"
- ]
- }
- ],
- "prompt_number": 17
- }
- ],
- "metadata": {}
- }
- ]
-} \ No newline at end of file