## Signals and communication Homework 2(8 problems)

Given the analog signal, sampled at the rate of 8000Hz (π‘) = 3 πππ ( 2π Γ 1500π‘) + 2 πππ ( 2π Γ 4200π‘) t β₯ 0 Sketch the spectrum of the sampled signal up to 20 KHz Unsampled signal spectrum is; X(jw) ββββββββββ(3/2)ββββββββββββ- ββββββββββ1βββββββββββββ -4.2 -1.5 1.5 4.2 kHZ Sampled signal spectrum is; X(jw) ββββββββββββββββββ(3/2)βββββββββββββββββββ ββββββββββββββββββ1βββββββββββββββββββββ -17.5 -16.0 -14.5 -12.4 -11.8 -9.5 -6.5 -3.8 3.8 6.5 9.5 11.8 12.4 14.5 16.0 17 khz frequency In the above spectrum, there is an overlap. (b) Sketch the recovered analog signal spectrum if an ideal low pass filter with cutoff frequency of 4KHz is used to filter the sampled signal in order to recover the original signal. X(jw) khz frequency -3.8 +3.8 2. Assuming that a 5 bit ADC channel accepts analog input ranging from 0 to 4 volts , determine the following Number of quantization levels Levels=25=32 Quantization step size Step size Quantization output level when the analog signal is 1.2 volts =20th level Binary code produced by the ADC in this case (1.2 volts input). Binary code for decimal 20 is 10100 3. MATLAB Project: Given a signal waveform (π‘) = 3.25 π ππ( 2π Γ 50π‘) + 1.25 πππ ( 2π Γ 100π‘ + π/4) Sample it at 8000 samples per second and (a) Write a MATLAB program to quantize x(t) using 6 bit bipolar quantizer to obtain the Quantized signal xq, assuming the signal range is from -5 to 5. The function below performs signal quantization decoding. Here X-min will be -5 and X-max will be +5. The function is named decodingquant and is added to the path of the software. It will be called in the main program. The bits will be 6 bits since we are using a 6 bit bipolar quantizer. function deout = decodingquant(bits,Xmin,Xmax,I) le=2*bits; delta=(Xmax-Xmin)/le; deout=Xmin+I*delta; %the following function performs signal quantization decoding. This is a code for a function named quantization that performs signal quantization: function [I, out] = quantization(bits,Xmin,Xmax, value) le=2*bits; delta=(Xmax-Xmin)/le; I=round((value-Xmin)/delta); if I==le I=I-1; end if I<0 I=0; end out=Xmin+I*delta; The main program: This is where we will call our functions: quantization decodingquant We also initialize and write the code. This program quantizes the signal using 6-bits bipolar quantizer to obtain the to obtain the quantized signal x_qΒ and plots the original and quantized signal. clc clear close all Tm=1/50; %Time period of the signal fs=8000; %This is the samplig frequency T=1/fs; %The sampling time period t=0:T:2*Tm; %This the the two period-time array. signal=3.25*sin(2*pi*50*t)+1.25*co bits=6; %6 bit quantizer as asked in the question. l=length(signal); ter initializing everything, we carry out quantization Index=zeros; quadsignal=zeros; for x=1:l [Index(x), qout]=quantization(bits,-5,5,signal(x)); end % we call the function inprder to recover signal from quantized values. % also indicate the signal range:from -5 to 5. for x=1:l quadsignal(x)=decodingquant(bits,-5,5,Index(x)); end plot(t,signal,'b') hold on stairs(t,quadsignal,'r'); ylabel('Signal') % xlabel('time (s)') legend('Original ','Quantized ') %Inorder to plot original signal and quantised signal. hold off