diff options
author | Prashant S | 2020-04-14 10:25:32 +0530 |
---|---|---|
committer | GitHub | 2020-04-14 10:25:32 +0530 |
commit | 06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch) | |
tree | 2b1df110e24ff0174830d7f825f43ff1c134d1af /Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
parent | 476705d693c7122d34f9b049fa79b935405c9b49 (diff) | |
download | all-scilab-tbc-books-ipynb-master.tar.gz all-scilab-tbc-books-ipynb-master.tar.bz2 all-scilab-tbc-books-ipynb-master.zip |
Initial commit
Diffstat (limited to 'Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb')
-rw-r--r-- | Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb | 1297 |
1 files changed, 1297 insertions, 0 deletions
diff --git a/Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb b/Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb new file mode 100644 index 0000000..3be2cf7 --- /dev/null +++ b/Digital_Communications_by_S_Sharma/4-WAVEFORM_CODING_TECHNIQUES.ipynb @@ -0,0 +1,1297 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: WAVEFORM CODING TECHNIQUES" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10: noise_ratio_and_required_bits.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption :noise ratio,required bits\n", +"//Example 4.10\n", +"//page no 173\n", +"//find i)noise ratio ii)bits\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"Am=3;\n", +"v=10;\n", +"SNR=1.8+6*v;//noise ratio \n", +"disp(SNR,'Signal to Quantization noise ratio');\n", +"disp('dB.');\n", +"SN=40;\n", +"v=(SN-1.8)/6;\n", +"\n", +"disp('bits required to get signal to niose ratio of 40dB',ceil(v));" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.11: Maximum_frequency.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption :Maximum frequency\n", +"//Example 4.11\n", +"//page no 174\n", +"//find Maximum frequency\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"v=7;\n", +"SNR=1.8+6*v;\n", +"r=56*10^3;\n", +"fs=r/v;//r=v*fs signaling rate\n", +"fm=fs/2;//Nquset rate\n", +"disp(fm/10^3,'Maximum frequency is');\n", +"disp('kHz');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.13: Maximum_Amplitude.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Maximum Amplitude\n", +"//Example 4.13\n", +"//page no 185\n", +"//Find Maximum Amplitude\n", +"clear;\n", +"clc;\n", +"fm=3*10^3;\n", +"Nyquistrate=2*fm;//Nyquistrate\n", +"fs=5*Nyquistrate;//Samplingfrquency\n", +"Ts=1/fs;// Sampling Interval\n", +"del=0.25;//step size\n", +"fm1=2*10^3;\n", +"Am=del/(2*%pi*fm1*Ts);\n", +"disp('Volts',Am,'Maximum Amplitude ');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.14: Signaling_rate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: signaling rate\n", +"//Example 4.14\n", +"//page no 187\n", +"//Find signaling rate\n", +"clear;\n", +"clc;\n", +"fs1=8*10^3;\n", +"del=31.25*10^-3;\n", +"q=64;\n", +"v=log2(q);\n", +"r=v*fs1;//signaling rate\n", +"disp(r*10^-3,'i)Signaling rate of PCM is');\n", +"disp('kHz');\n", +"\n", +"fm=3*10^3;\n", +"A=1;\n", +"fs2=(2*%pi*fm*A)/(del);\n", +"disp(fs2*10^-3,'ii)The signaling rate of DM is');;\n", +"disp('kHz');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.15: Signal_to_noise_ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Signal to noise ratio\n", +"//Example 4.15\n", +"//page no 188\n", +"//Find signal to noise ratio\n", +"clear;\n", +"clc;\n", +"fs=64*10^3;\n", +"fm=2*10^3;\n", +"fM=4*10^3;\n", +"SNR=(3*fs^3)/(8*%pi^2*fm^2*fM);// Signal to noise ratio\n", +"SNRO=10*log10(SNR)\n", +"disp('dB',SNRO,'Output signal to noise ratio =');\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.16: Signal_to_Quatization_noise_ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Signal to Quatization noise ratio\n", +"//Example 4.16\n", +"//page no 188\n", +"//Find signal to Quatization noise ratio \n", +"clear;\n", +"clc;\n", +"\n", +"fs=8*10^3;\n", +"r=64*10^3;\n", +"N=8;//number of bits\n", +"SNR=(1.8+6*N);//signal to Quatization noise ratio\n", +"disp(SNR,'Signal to Quatization noise ratio of PCM system is')\n", +"disp('dB');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.17: sampling_rate_and_quantizing_level.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: sampling rate,quantizing level\n", +"//Example 4.17\n", +"//page no 194\n", +"//Find sampling rate,quantizing level\n", +"clear;\n", +"clc;\n", +"r=36000;\n", +"fm=3.2*10^3;\n", +"fs=2*fm;//Nquest rate\n", +"\n", +"v=r/fs; //r=v*fs signaling rate\n", +"v=floor(v);\n", +"q=2^v;\n", +"fs1=r/v;\n", +"disp(q,'quantizing level q=');\n", +"disp(fs1/1000,'sampling rate fs=');\n", +"disp('kHz');\n", +"disp(v,'Number of binary digits =')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.18: time_duration_of_binary_signal.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: time duration of binary signal\n", +"//Example 4.18\n", +"//page no 196\n", +"//Find time duration of 1bit binary encoded signal\n", +"clear;\n", +"clc;\n", +"fs=input('Enter the Nyquist rate of Signal fs(Hz)=');\n", +"q=input('Enter the Quantization levels q =');\n", +"\n", +"v=log2(q);//binary pulses transmitted per second\n", +"t=1/(v*fs);//Nyquist interval\n", +"disp(' sec',t,' Time duration of binary signal t=');\n", +"//output\n", +"//Enter the Nyquist rate fs(Hz)=3\n", +"//Enter the Quantization levels q =5\n", +" \n", +" // time duration of 1bit binary signal \n", +" \n", +" // t=0.1435589 sec\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.20: Quantizing_noise_ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"\n", +"//Caption: Quantizing noise ratio\n", +"//Example 4.20\n", +"//page no 196\n", +"//find signal to noise ratio\n", +"clc;\n", +"clear;\n", +"\n", +"SNR=40;\n", +"SNRO=10^(SNR/10);\n", +"//SNR=3(q^2)/2, Signal to Quantization noise ratio\n", +"q=sqrt((2*SNRO)/3);\n", +"q=ceil(q);\n", +"v=log2(q);//q=2^v Quantization levels\n", +"v=ceil(v);\n", +"snr=1.76+6.02*v;//output Signal to Quantization noise ratio\n", +"disp('dB',snr,'Output Signal to Quantization noise ratio')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.21_ii: Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Bandwidth\n", +"//Example 4.21.i\n", +"//page no 197\n", +"//Find minimum required bandwidth\n", +"clear;\n", +"clc;\n", +"SNRO=30;//dB\n", +"fmin=300;\n", +"fmax=3300;\n", +"fs=8000;\n", +"v=5;\n", +"fPCM=(v*fs)/2;\n", +"disp(fPCM/1000,'minimum required bandwidth');\n", +"disp('kHz');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.21_iii: Quantizing_levels_bits_per_sample_and_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Quantizing levels,bits per sample,Bandwidth\n", +"//Example 4.21.iii\n", +"//page no 197\n", +"//Find Quantizing levels,minimum number of bits per sample and bandwidth\n", +"clear;\n", +"clc;\n", +"SNRO=30;//dB\n", +"fmin=300;\n", +"fmax=3300;\n", +"fs=8000;\n", +"\n", +"q=10^((SNRO+10.1)/20);\n", +"q=ceil(q);\n", +"v=log2(q);\n", +"v=ceil(v);\n", +"disp(q,'Quantizing levels need is');\n", +"disp(v,'minimum number of bits per sample is');\n", +"\n", +"\n", +"fPCM=(v*fs)/2;\n", +"disp(fPCM/1000,'minimum required bandwidth');\n", +"disp('kHz');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.21_i: Quantizing_levels_and_bits_per_sample.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Quantizing levels, bits per sample\n", +"//Example 4_21.i\n", +"//page no 197\n", +"//Find Quantizing levels,minimum number of bits per sample\n", +"clear;\n", +"clc;\n", +"SNRO=30;//dB\n", +"fmin=300;\n", +"fmax=3300;\n", +"fs=80000;\n", +"//SNRO=1.76+20log10(q)\n", +"q=10^((SNRO-1.76)/20);\n", +"q=ceil(q);\n", +"v=log2(q);\n", +"disp(q,'Quantizing levels required is');\n", +"disp(ceil(v),'minimum number of bits per sample are');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.24: Maximum_Amplitude_and_SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Maximum Amplitude,SNR\n", +"//Example 4.24\n", +"//page no 199\n", +"//determine the Maximum Amplitude,\n", +"// \n", +"clear;\n", +"clc;\n", +"del=250*10^-3;\n", +"wm=2*%pi*1000; \n", +"fs=3*10^3;\n", +"Ts=1/fs\n", +"\n", +"Amax=(del*3*fs*2)/(wm);//Amplitude\n", +"disp('V',Amax,'Maximum Amplitude,');\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.26: Bits_per_sample.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Bits per sample\n", +"//Example 4.26\n", +"//page no 200\n", +"//Find number of bits per sample\n", +"clear;\n", +"clc;\n", +"SNR=20;//dB\n", +"averagepower=30*10^-3;\n", +"SNRO=10^(SNR/10);//dB\n", +"A=3.8;\n", +"//L=2^n\n", +"//SNRO=average signal power/Quatizing power\n", +"//del=(2*A)/L\n", +"L=sqrt((SNRO*A^2)/(3*averagepower));\n", +"n=log2(L);\n", +"n=ceil(n);\n", +"disp(n,'Bits required per sample');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.27_ii: Bit_transmission_rate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Bit transmission rate\n", +"//Example 4.27.ii\n", +"//page no 200\n", +"//Find bit transmission rate\n", +"clear;\n", +"clc;\n", +"fm=3*10^3;\n", +"v=8;\n", +"VH=5;\n", +"VL=-5;\n", +"q=2^v;\n", +"\n", +"fs=2*fm; //Nyquist rate\n", +"r=8*fs;\n", +"disp('K bits/s',r/1000,'bit transmission rate');\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.27_iii: SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: SNR\n", +"//Example 4.27.i\n", +"//page no 200\n", +"//Find Signal to quantization noise ratio\n", +"clear;\n", +"clc;\n", +"Nq=127.15*10^-6\n", +"Meansignal=2;\n", +"P=Meansignal/1;\n", +"SNR=P/Nq;\n", +"SNRq=10*log10(SNR);\n", +"disp('dB',SNRq,'Signal to quantization noise ratio');\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.27_i: Normalized_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:Normalized power \n", +"//Example 4.27.i\n", +"//page no 200\n", +"//Find Normalized power for quantization noise\n", +"clear;\n", +"clc;\n", +"fm=3*10^3;\n", +"v=8;\n", +"VH=5;\n", +"VL=-5;\n", +"q=2^v;\n", +"del=(VH-VL)/q;\n", +"Nq=del^2/12;//quantization noise\n", +"disp('W',Nq,'Normalized power for quantization noise')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.28: SNR_bitrate_and_no_of_bits_recorded.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: SNR,bitrate,no.of bits recorded\n", +"//Example 4.28\n", +"//page no 201\n", +"//Find i)SNR ii)output bit rate iii)no.of bits recorded\n", +"clear;\n", +"clc;\n", +"N=16;\n", +"v=16;\n", +"fs=44.1*10^3;\n", +"SNR=1.76+6*N;\n", +"disp('dB',SNR,'i)Out put signal noise ratio');\n", +"bitrate=2*v*fs;\n", +"outputbitrate=2*bitrate;//including addtional 100% over head\n", +"disp('Mbits/sec',outputbitrate*10^-6,'ii)output bit rate');\n", +"CD=outputbitrate*3600;\n", +"disp('gigabits',CD*10^-9,'iii)no.of bits recorded in CD');\n", +" " + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.29: output_SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: output SNR\n", +"//Example 4.29\n", +"//page no 202\n", +"//Find output SNR\n", +"clear;\n", +"clc;\n", +"fm=1*10^3;\n", +"fs=32*10^3;\n", +"FM=4*10^3;// Bandwidth\n", +"SNR=(3*fs^3)/(8*%pi^2*fm^2*FM);//SNR\n", +"SNRO=10*log10(SNR);\n", +"disp('dB',SNRO,'Output signal to noise ratio');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2_i: code_word_length.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:code word length\n", +"//Example 4.2.i\n", +"//page no 167\n", +"//find code word length\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"bandwidth=4.2*10^6;\n", +"fm=bandwidth;\n", +"q=512// Quantization levels\n", +"//q=2^v\n", +"v=log10(512)/log10(2);\n", +"disp(v,'The code word legth is ');\n", +"disp('bits');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2_iii: Final_Bit_rate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Final Bit rate\n", +"//Example 4.2.iii\n", +"//page no 167\n", +"//find Final Bit rate\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"bandwidth=4.2*10^6;\n", +"fm=bandwidth;\n", +"q=512// Quantization levels\n", +"v=9;\n", +"fs=2*fm;\n", +"r=v*fs;//signaling rate\n", +"disp(r,'Final Bit rate ');\n", +"disp('bits/sec');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2_ii: Transmission_Bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Transmission Bandwidth\n", +"//Example 4.2.ii\n", +"//page no 167\n", +"//find The transmission Bandwidth\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"bandwidth=4.2*10^6;\n", +"fm=bandwidth;\n", +"q=512// Quantization levels\n", +"v=9;\n", +"bw=v*fm;\n", +"disp(bw*10^-6,'The transmission Bandwidth is ');\n", +"disp('MHz');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2_iv: Output_signal_to_noise_ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Output signal to noise ratio\n", +"//Example 4.2.iv\n", +"//page no 167\n", +"//find Output signal to noise ratio\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"bandwidth=4.2*10^6;\n", +"fm=bandwidth;\n", +"q=512// Quantization levels\n", +"v=9;\n", +"sn=4.8+6*v;//noise in dB\n", +"disp(sn,'Output signal to noise ratio is');\n", +"disp('dB');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.30_iii: Signal_to_Noise_Ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: SNR\n", +"//Example 4.30iii\n", +"//page no 202\n", +"//Find SNR\n", +"clear;\n", +"clc;\n", +"fs=64000;\n", +"Amax=1;\n", +"fm=3500;\n", +"Nqd=2.1522995*10^-3;\n", +"So=Amax^2/2;\n", +"SNR=So/Nqd;\n", +"SNRO=10*log10(SNR);\n", +"disp('dB',SNRO,'Output signal noise ratio');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.30_ii: Noise_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: noise power\n", +"//Example 4.30ii\n", +"//page no 202\n", +"//Find Quantizatio noise power \n", +"clear;\n", +"clc;\n", +"fs=64000;\n", +"Amax=1;\n", +"fm=3500;\n", +" del=343.6117*10^-3;//step size\n", +" Nq=del^2/3;//Quantizatio noise power\n", +" Nqd=Nq*(fm/fs);\n", +"disp('mW',Nqd*1000,'Quantizatio noise power ');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.30_i: step_size.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: step size\n", +"//Example 4.30i\n", +"//page no 202\n", +"//Find step size\n", +"clear;\n", +"clc;\n", +"fs=64000; // samples/sec\n", +"Amax=1;\n", +"fm=3500;\n", +"//A=del/(2*%pi*fm*Ts)\n", +"del=(2*%pi*fm*Amax)/fs;\n", +"disp('mV',del*1000,'Step Size ');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.31: number_of_bits_per_sec.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: no.of bits/sec\n", +"//Example 4.31\n", +"//page no 203\n", +"//Find no.of bits/sec\n", +"//assuming signal is sampled at the rate 20% above Nyquist rate\n", +"clear;\n", +"clc;\n", +"fm=4.5*10^6;\n", +"q=1024;\n", +"fs=1.2*2*fm;//20% above Nyquist rate\n", +"v=log2(q);\n", +"r=v*fs;\n", +"disp('M bit/sec',r/10^6,'no.of bits/sec');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.32: step_size_noise_power_and_SNR.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: step size,noise power, SNR\n", +"//Example 4.32\n", +"//page no 203\n", +"//Find step size,noise power, SNR\n", +"//assume bandwidth of the singal is 4kHz\n", +"clear;\n", +"clc;\n", +"fs=32000;\n", +"A=2;\n", +"fm=4000;\n", +"BW=4000;\n", +"del=(2*%pi*fm*A)/fs;\n", +"disp('Volt',del,'i)step size');\n", +"Nq=del^2/3\n", +"disp('W',Nq,'ii)noise power');\n", +"SNR=(3*fs^3)/(8*%pi^2*fm^2*BW);\n", +"disp(SNR,'iii)SNR=');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.33: signaling_rate_and_bandwidth.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: signaling rate, bandwidth\n", +"//Example 4.33\n", +"//page no 204\n", +"//Find signaling rate, bandwidth\n", +"//assuming signal is sampled at the rate 20% above Nyquist rate\n", +"clear;\n", +"clc;\n", +"fm=15*10^3;\n", +"fs=1.2*2*fm;\n", +"q=65536;\n", +"v=log2(q);\n", +"r=v*fs;\n", +"disp('i)signaling rate,')\n", +"disp('K bits/sec',r/1000,'r=');\n", +"BW=r/2;\n", +"disp('ii)bandwidth')\n", +"disp('kHz',BW/1000,'BW min=')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.34: Step_size_and_Noise_power.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: step size,noise power\n", +"//Example 4.34\n", +"//page no 204\n", +"//Find step size,noise power\n", +"clear;\n", +"clc;\n", +"fs=64*10^3;\n", +"fm=3500;\n", +"A=1;\n", +"del=(2*%pi*fm*A)/fs;//step size\n", +"disp('Volts',del,'i)step size');\n", +"Nq=(del^2/3)*(fm/fs);//Granular noise power\n", +"disp('W',Nq,'ii)Nq=');" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3_i: bits_per_sample.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption :bits per sample\n", +"//Example 4.3.i\n", +"//page no 168\n", +"//find bits per sample\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"fmax=4*10^3;\n", +"xmax=3.8;\n", +"snr=100;\n", +"P=30*10^-3;\n", +"v=(log10(((snr*xmax^2)/(3*P)))/(2*log10(2)));\n", +"disp(ceil(v),'Number of bits required per sample are');\n", +"disp('bits');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3_ii: Transmission_Bandwith.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Transmission Bandwith\n", +"//Example 4.3.ii\n", +"//page no 168\n", +"//Find Transmission Bandwith\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"fm=4*10^3;//Bandwidth of PCM\n", +"xmax=3.8;\n", +"snr=100;// Signal to Noise Ratio\n", +"outputs=30;\n", +"v=7;\n", +"bw=outputs*v*fm;\n", +"r=bw*2;\n", +"disp(bw/10^3,'Transmission Bandwith');\n", +"disp('kHz');\n", +"disp('bits/sec',r/1000,'Signaling rate')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: samplingrate_bandwidth_and_bitrate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: samplingrate,number of bits,bitrate,bandwidth\n", +"//Example 4.4\n", +"//page no 169\n", +"//find sampling rate,number of bits,bit rate,bandwidht\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"emax=0.001;\n", +"del=2*emax;;\n", +"fm=100;\n", +"xmax=10;\n", +"\n", +"q=(2*xmax)/del;\n", +"fs=2*fm;\n", +"v=(log10(q))/log10(2);\n", +"v=ceil(v);\n", +"r=v*fs;\n", +"disp(fs,'i)sampling Frequncy');\n", +"disp('Hz.');\n", +"disp(v,'ii)no.of bits in PCM');\n", +"disp('bits.');\n", +"disp(r,'iii)sampling rate');\n", +"disp('bits per second.');\n", +"disp(r/2,'iv)Transmission Bandwidth');\n", +"disp('Hz.');\n", +"\n", +"\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: Bandwidth_and_Sampling_Rate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Bandwidth,Sampling Rate\n", +"//Example 4.5\n", +"//page no 170\n", +"//Find Bandwidth,Sampling Rate\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"fm=3.4*10^3;\n", +"N=24;\n", +"r=1.5*10^6;\n", +"encoder=8;\n", +"\n", +"BW=N*fm;\n", +"disp(BW/10^3,'Channel Bandwith is');\n", +"disp('kHz');\n", +"\n", +"r1=r/N;\n", +"fs=r1/encoder;\n", +"\n", +"disp(fs,'sampling frequency');\n", +"disp('Hz or samples per second.');\n", +"\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Signal_Bandwidth_and_Noise_Ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: Signal Bandwidth,Noise Ratio\n", +"//Example 4.6\n", +"//page no 170\n", +"//Find Signal Bandwidth,Noise Ratio\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"v=7;\n", +"r=50*10^6;\n", +"//fs=2*fm\n", +"fm=r/(2*v);\n", +"disp(fm*10^-6,'Maximum message Bandwidth is ');\n", +"disp('MHz');\n", +"\n", +"snr=1.8+(6*v);\n", +"disp(snr,'signal to quantization niose ration');\n", +"disp('dB');\n", +"" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7: Bitspersample_and_Transmissionrate.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption: bitspersample,Transmissionrate\n", +"//Example 4.7\n", +"//page no 171\n", +"//find i)bits per sample,ii)transmission rate\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"fm=3*10^3;\n", +"q=16;\n", +"\n", +"v=(log10(q))/log10(2);\n", +"disp(v,'bits in code word');\n", +"disp('bits');\n", +"fs=2*fm;\n", +"r=v*fs;\n", +"disp(r,'bit trasmission rate');\n", +"disp('bits per second')" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.8: signal_to_noise_ratio.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"//Caption:signal to noise ratio\n", +"//Example 4.8\n", +"//page no 171\n", +"//find signal to noise ratio\n", +"clc;\n", +"clear;\n", +"//Given data\n", +"fm=3.5*10^3;\n", +"r=50*10^3;\n", +"fs=2*fm;\n", +"rms=0.2;\n", +"xmax=2;\n", +"v=r/fs;//signaling rate r=v*fs\n", +"v=ceil(v);\n", +"P=(rms^2)/1;\n", +"SNR=((3*P*2^(2*v))/(xmax^2));\n", +"SN=10*log10(SNR);\n", +"disp(ceil(SN),'signal to niose ratio');\n", +"disp('dB');" + ] + } +], +"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 +} |