summaryrefslogtreecommitdiff
path: root/Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb
diff options
context:
space:
mode:
authorPrashant S2020-04-14 10:25:32 +0530
committerGitHub2020-04-14 10:25:32 +0530
commit06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch)
tree2b1df110e24ff0174830d7f825f43ff1c134d1af /Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb
parentabb52650288b08a680335531742a7126ad0fb846 (diff)
parent476705d693c7122d34f9b049fa79b935405c9b49 (diff)
downloadall-scilab-tbc-books-ipynb-master.tar.gz
all-scilab-tbc-books-ipynb-master.tar.bz2
all-scilab-tbc-books-ipynb-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Initial commit
Diffstat (limited to 'Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb')
-rw-r--r--Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb261
1 files changed, 261 insertions, 0 deletions
diff --git a/Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb b/Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb
new file mode 100644
index 0000000..3a86a54
--- /dev/null
+++ b/Analog_Communication_by_V_Chandrasekar/5-Pulse_Modulation.ipynb
@@ -0,0 +1,261 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 5: Pulse Modulation"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1.A: Sample_and_Hold.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"//('current through the capacitor is i=C(dv/dt)');\n",
+"\n",
+"t=15; //acquisition time in us\n",
+"i=5; //current in mA\n",
+"v=5; //maximum voltage across capacitor in V\n",
+"\n",
+"\n",
+"// to satisfy current requirement\n",
+"disp('to satisfy current requirement');\n",
+"C_current_req=i*t/v;\n",
+"disp(C_current_req,'C(nF)=');\n",
+"\n",
+"//to satisfy accuracy requirement\n",
+"disp('to satisfy accuracy requirement');\n",
+"\n",
+"C_accuracy_req=t/(6.9*15)*1000;// to convert into 'nanoFarad'\n",
+"\n",
+"disp(C_accuracy_req,'C(nF)=');\n",
+"\n",
+"disp('to satisfy both requirements,smaller of the two can b taken');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.1: Sampling.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clear;\n",
+"clc;\n",
+"disp('for 8-KHz sampling,the frequencies present are...(in KHz)');\n",
+"\n",
+"Fs=8; //sampling frequency\n",
+"Fst=3.5 //single tone frequency\n",
+"\n",
+"disp(Fst);\n",
+"disp(-Fst);\n",
+"disp(Fs-Fst);\n",
+"disp(-(2*Fs+Fst),(2*Fs+Fst),-(Fs+Fst),(Fs+Fst),(Fs-Fst));\n",
+"disp('...etc...');\n",
+"\n",
+"disp('in this case, if the LPF is designed with cut-off frequency(8/2= 4-KHz)');\n",
+"disp('then the maximum passable frequency is 3.5-KHz');\n",
+"disp('for 5-KHz sampling,the frequencies present are...(in KHz)');\n",
+"\n",
+"Fs=5;//new sampling frequency\n",
+"disp(Fst);\n",
+"disp(-Fst);\n",
+"disp(Fs-Fst);\n",
+"disp(-(2*Fs+Fst),(2*Fs+Fst),-(Fs+Fst),(Fs+Fst),(Fs-Fst));\n",
+"disp('...etc...');\n",
+"\n",
+"disp('in this case, if the LPF is designed with cut-off frequency(5/2=2.5-KHz)');\n",
+"disp('then the original signal cant be passed');\n",
+"disp('therefore, the signal cant be reconstructed');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.2_A: Aliasing_Frequency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"F_audio=5; //Audio input Frequency in kHz\n",
+"\n",
+"F_sampling=2*F_audio;\n",
+"\n",
+"disp(F_sampling,'The Minimum Sampling Frequency (in kHz)');\n",
+"\n",
+"disp('When the audio Frequency of 6 Khz enters the Sample and Hold circuit');\n",
+"disp('it will overlap the audio spectrum, and the alaising frequency is 4 kHz');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.2: Sampling_Rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"\n",
+"//x(t)=2sin(4000*pi*t)+3sin(5000*pi*t)+4sin(8000*pi*t)\n",
+"\n",
+"fh=8000/2;\n",
+"fl=4000/2;\n",
+"\n",
+"disp(fh,'a) Highest Frequency component(in Hz)');\n",
+"disp(fl,'Lowest Frequency component(in Hz)');\n",
+"\n",
+"fs=2*fh;\n",
+"disp(fs,' Minimum Sampling frequency(in Hz)');\n",
+"\n",
+"Bw=fh-fl;\n",
+"disp(Bw,' b)Bandwidth(in Hz) is');\n",
+"\n",
+"n=fh/Bw;\n",
+"disp(n,'integer factor');\n",
+"\n",
+"Fs_new=2*fh/n;\n",
+"disp(Fs_new,'Required Sampling frequency in this case(in Hz) is');\n",
+"\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.3_A: PCM_system.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"fm=5;// maximum analog frequency in kHz\n",
+"Min_dyna_range=35;\n",
+"Vr=3; //Voltage in the receiver in V\n",
+"\n",
+"//a)\n",
+"F_sampling=2*fm;\n",
+"\n",
+"//b)\n",
+"n=Min_dyna_range/6;\n",
+"k=(Vr-(-Vr)+1);// inclusive of sign bit\n",
+"\n",
+"//c)\n",
+"Resolution=Vr/(2^(7));\n",
+"\n",
+"//d)\n",
+"Max_quant_Error=Resolution/2\n",
+"\n",
+"disp(F_sampling,'a)Minimum Sampling Rate(in kHz) =');\n",
+"disp(n,'b) Minimum dynamic Range is');\n",
+"disp(' But Closest whole number is 6. Henc,6 bits must be used for amplitude' );\n",
+"disp('But the amplitude range is from -3 to +3 V,hence a sign bit also ');\n",
+"disp( k,'becomes necessary..Therefore,the total number of bits');\n",
+"disp(Resolution,'c) Resolution(in V) =');\n",
+"disp(Max_quant_Error,' d)MAximum Quantization Error (in V) ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5.4_A: Bandwidth_of_PCM_system.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"n=16;// Number of telephone lines\n",
+"m=256;//Quantization levels\n",
+"q=8;// since 2^(q)=256\n",
+"\n",
+"fs=10;//Sampling frequency in kHz\n",
+"\n",
+"Bw=[(16*9)+1]*10*10^(3);\n",
+"\n",
+"disp(Bw,'Bandwidth (in Hz ) 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
+}