0% found this document useful (0 votes)
12 views9 pages

Digital Signal Processing Lab Experiment 2

Uploaded by

moushmithondepu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views9 pages

Digital Signal Processing Lab Experiment 2

Uploaded by

moushmithondepu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

DIGITAL SIGNAL PROCESSING LAB

EXPERIMENT 2

1)​ Generate an approximate analog signal given by x(t) = 5 cos (2π × 100t),t ≥ 0
●​ with the spacing between the samples to be very small (≈0), say 10μs =
0.00001.
●​ Choose the time duration, say x(t) exists for 0.1seconds.

DISCUSSION:

●​ In MATLAB, in order to generate a continuous signal, we need to use the plot()


function
●​ In order to generate a discrete signal, we need to use the stem() function.
●​ We can approximate this signal to the continuous signal by taking the sample
frequency to be very high (like here) i.e. to take a small sample spacing
2)​ Nyquist sampling: Generate the sampled signal by sampling the aforementioned
signal with sampling frequency f௦ = 2 × f.

DISCUSSION:

●​ On taking the Nyquist rate to sample the signal, we can observe that a periodic
signal can be approximated well on a basic level.
●​ Nyquist rate is given as sampling frequency is greater than or equal to twice of
the message signal frequency.
●​ In the Nyquist rate, per time period, there will be 2 samples in one oscillation of
signal.
●​ In this case, for a sinusoidal signal with one frequency component, we have two
samples in one time period, one at the positive peak (+5) and one at the negative
peak (-5)
3)​ Undersampling and Oversampling: Repeat step 2 for different sampling
frequencies, i.e.,
f௦ = 1.3 × f & f௦ = 2.2 × f

DISCUSSION:

●​ Undersampling a signal means to sample it at a frequency lower than the Nyquist


frequency
●​ On Undersampling, the shape of the sampled signal is completely different from
the original signal. Extracting the original signal will be difficult.
●​ Oversampling a signal means to sample it at a frequency higher than the Nyquist
frequency
●​ On Oversampling, we observe that the ‘shape’ of the sampled signal is preserved
and is very similar to the original signal. The original signal can be extracted from
the Discrete Signal
4)​ Display the aliased signal and input signal in the same graph plot.

DISCUSSION:

●​ The ‘shape’ of the aliased signal is completely different from the original signal.
This is due to aliasing
●​ Due to the shape of the signal not being preserved, we are not able to extract the
original signal
5)​ Natural Sampling

●​ Generate an approximate analog signal given by x(t) = 5 sin (2π × 1t),t ≥ 0


for a period of 3 sec and perform ideal sampling of the same.
●​ Generate a pulse train with 10 pulses of equal intervals in the duration of a
single cycle of the analog waveform.
●​ Display the output waveform of the natural sampling operation.

DISCUSSION:

●​ Unlike Ideal Sampling the Natural Sampling does not have proper ‘samples’. The
resultant signal is the same pulse train with amplitude varying with analog signal
●​ The pulse train can be generated using the square() function and to restrict it to
positive values, we can set all values of the resulting 1D matrix to 0 if it is a
negative number
EXERCISES

Self study topics:

1) Load Speech/Music data (1D), Gray scale image (2D) and Video (3D) data and
understand the Matrix representation of the same using MATLAB workspace.

2) Understand the concept of upsampling and downsampling a signal.

3) Apply the upsampling and downsampling operations on an audio file (say, an audio
with sampling frequency 44100 Hz) and listen to the original audio and the audio files
after the Operations.
DISCUSSION :

Representing Images, Video and Audio files in MATLAB

●​ Different types of data (speech/music, images, videos) are effectively


represented as matrices in MATLAB.
●​ Speech and audio signals are represented as a 1D matrix in general
●​ However, if the audio file is of a stereo type, the matrix is a 2D one with 2
columns (Left and Right Channels). In the following graph, that is a stereo audio
file
●​ Images can be either 2D or 3D Matrices:
○​ Grayscale Images are usually 2D Matrices (for brightness values between
1 to 255)
○​ Color Images are 3D matrices to accommodate the RGB values between 1
to 255
●​ Video Files are 4D Matrices which has each frame represented by a 3D Image
Matrix

Upsampling and Downsampling

Upsampling

●​ Upsampling increases the data rate and introduces new samples.It might
increase the file size without improving audio quality significantly.
●​ If we need to upsample the file by n times, we will be adding n-1 0’s between each
sample
●​ Upsampling increases the length of the audio file by n times. In our experiment,
we used an audio file of 10s. On upsampling by 5 times, we got the file to about
52s

Downsampling

●​ Downsampling decreases the data rate by reducing the number of samples.It


may lead to loss of information, especially at higher frequencies.
●​ If we need to downsample the file by n times, we take every nth sample
●​ Upsampling decreases the file length by n times. In our experiment, the same 10s
audio file we used reduced to 2s after downsampling
Conclusion

●​ Both operations have implications for the signal's frequency content and can
impact the perceived audio quality.
●​ The choice between upsampling and downsampling depends on the specific
requirements of the application, such as file size, bandwidth constraints, or
processing efficiency.

(D12) GROUP MEMBERS:

T.K.SREEVATSA MURTHY (B210656EC)


THONDEPU MOUSHMI(B210745EC)

You might also like