Experiment 3. Digital Process of Continuous Time Signal. Introduction Discrete time signal processing algorithms are being used to process naturally occurring analog signals (like speech, music and images). Before any analog signals can be processed digital, they need to be first converted to the discrete time signal by taking samples of the signal in the time domain. The discrete time signal will then have to be digitized i.e. quantized the magnitude of each sample. For processing by digital system the discrete time signal are represented in digital form with each discrete time sample represented by binary number. Therefore we need the analog-to-digital and digital-toanalog converter to convert the continuous time signal into discrete-time digital form and vice versa. Since the analog-to-digital conversion usually takes finite amount of time it is necessary to ensure that analog signal remain constant in amplitude until the conversion complete in order to minimize the error in its representation. This is accomplished by a device called sample-and-hold (S/H) circuit which has dual purposes. It not only samples the input continuous signal at periodic intervals but also holds the analog sampled value constant at its output for sufficient time to permit accurate conversion by A/D converter. The output of this device a somewhat like a stairs case function. It is necessary to smooth the D/A converter output by means of an analog reconstruction (smoothing) filter. In most cases, the continuous time signal to be processed usually has a larger bandwidth when compared to the sampling rate of the sample and hold. To prevent a detrimental effect called aliasing an analog anti-aliasing filter is often placed before the S/H circuit. Figure : Block diagram of Digital signal processing
Figure: Continuous to digital signal conversion Experiment Objective Introduction to the concept of continuous time signal conversion to digital signal ie Sampling theorem Reconstruction using ideal lowpass filter and introduction to the aliasing Procedure Section -Aliasing due to undersampling Open new M-file and write this command or mark, copy and paste into the editor:- % Program Exp3 % Addition of cosine sequences and aliasing % fs = input('aliasing\ntype in freq of sampling in Hertz = '); f = input('type in freq of first cosine sequence in Hertz = '); f = input('type in freq of second cosine sequence in Hertz = '); %f3 = input('type in freq of third cosine sequence in Hertz = '); K = input('type in the first gain constant = '); K = input('type in the second gain constant = '); %K3 = input('type in the third gain constant = '); N = input ('Type in length of sequence = '); n = :N; %x = K*exp(c*n);%Generate the sequence xa=k*cos(*pi*(n)*f/fs); xa=k*cos(*pi*(n)*f/fs); xa3=xa+xa; dt=/fs; subplot(3,,); stem(n,xa);%plot the first cosine signal
xlabel('time index n');ylabel('amplitude'); title('cosine Signal'); % pause; % Calling the ploting of the magnitude spectrum function subplot(3,,); fplot(xa,dt); subplot(3,,3); stem(n,xa);%plot the first cosine signal subplot(3,,4); fplot(xa,dt); subplot(3,,5); stem(n,xa3);%plot the first cosine signal ubplot(3,,3); subplot(3,,6); fplot(xa3,dt); Make sure fplot.m is present in the Matlab current directory. Run the program with the following input:- and copy the figure.
Amplitude Cosine Signal 6 4 - - 3 4 5 6 Time index n - - 3 4 5 6 4 - -4 3 4 5 6.5.5.5 3 3.5 4 6 4.5.5.5 3 3.5 4 6 4.5.5.5 3 3.5 4 Now, let s choose a different sampling frequency fs=3 keeping the rest of the input the same as before:- Run the program again
Amplitude and copy the figure Cosine Signal 6 4 - - 3 4 5 6 Time index n - - 3 4 5 6 4 - -4 3 4 5 6..4.6.8...4.6 6 4..4.6.8...4.6 5 5..4.6.8...4.6
Section : Aliasing on the audio signal.. Open new M-file and write this code fs = 8; % set the sampling rate T = /fs; % sample interval tfinal = 4; % length of time k = :tfinal/t; % index vector f = 44; % signal is at 44 Hz sig =.*cos(*pi*f*k*t); % generate samples of the sinusoidal signal sound(sig,fs); % Play the signal (at 8 samples/sec) fplot(sig,t);. Run the program and copy the figure. 3. Try to change the amplitude from. to 4. Run the program 5. Listen to the sound obtained and copy the figure 6. Compare sound of both amplitude and explain Section -Aliasing due to undersampling Exercise. Compare and explain the spectrum of signals when the sampling frequencies were 8Hz and 3Hz.. What will be the highest frequency of the information signal if the sampling frequency is 8Hz. Verify your answer by running the program in section with appropriate inputs. Section - Aliasing on audio signal.. What will be the optimum sampling frequency in order for you to hear the same tone as per program in section. Verify your answer by modifying the program and listening to the output signal through the speaker.. Determine whether aliasing has occur for the following combinations of sampling and signal frequencies. Listen and look at the plot of the spectrum for each case. Submit the spectrum of the signal obtained for each case. Sampling Frequency(Hz) Information Signal Frequency(Hz) 6 3 4 5 4 5 5
Amplitude Section -Aliasing due to undersampling With sampling frequency = 3Hz. Result Cosine Signal 6 4 - - 3 4 5 6 Time index n - - 3 4 5 6 4 - -4 3 4 5 6..4.6.8...4.6 6 4..4.6.8...4.6 5 5..4.6.8...4.6 However with fs=8 (no Aliasing);
Amplitude Cosine Signal 6 4 - - 3 4 5 6 Time index n - - 3 4 5 6 4 - -4 3 4 5 6.5.5.5 3 3.5 4 6 4.5.5.5 3 3.5 4 6 4.5.5.5 3 3.5 4 Section : Aliasing on the audio With amplitude. Sound: Slow Sound
35 3 5 5 5.5.5.5 3 3.5 4 With amplitude Sound: Louder (than. amplitude)
3.5 x 4 3.5.5.5.5.5.5 3 3.5 4