A mid-rise type quantizer for my DSP lab course. The question is as below.
Generate a discrete-time sinusoidal signal x[n] with the SinSamples() function implemented in preliminary work of experiment 1, with the parameters: A=3, w=2*pi, ws=2*pi*50, .θ=0, d=2sec. Implement 3-bit midrise type quantizer. Make the reconstruction levels be spaced so as to span the entire amplitude range of the signal. You may use the maximum amplitude of the signal in designing reconstruction levels. Plot original signal, quantized version, and quantization error. Calculate output signal to noise ratio in dB (all signal to noise ratios must be calculated in dB).

Generate a discrete-time sinusoidal signal x[n] with the SinSamples() function implemented in preliminary work of experiment 1, with the parameters: A=3, w=2*pi, ws=2*pi*50, .θ=0, d=2seca) Implement 3-bit midrise type quantizer. Make the reconstruction levels be spaced so as to span the entire amplitude range of the signal. You may use the maximum amplitude of the signal in designing reconstruction levels. Plot original signal, quantized version, and quantization error. Calculate output signal to noise ratio in dB (all signal to noise ratios must be calculated in dB).

And the output is as below;

Edited: Changed code to a more correct version!
The question was;

Load the file sound1.wav(Download from here => [download id=”2″] ) (You would use MATLAB command ‘wavread’ to loadthis file. Use MATLAB help to learn the usage of ‘wavread’). This file contains a portion of speech waveform. Take the first 512 point the signal, plot the waveformand its magnitude spectrum.

The question was :

Write a MATLAB function, x = SinSamples(A, w, θ, d, ws), that generates a discrete-time sinusoidal signal x[n] obtained by sampling x(t), (Assume that x(t) is a sinusoidal segment with amplitude A, frequency ω, phase θ and duration ), with sampling frequency ω_s.

For sample code ;

The output is;

and;

Hi there! Have some new code based on Matlab. It was actually a Computer Exercise for my Telecom course. It is an example of Amplitude Modulation of a Cos based message. The code is easy enough. If you have any questions please ask. Hope you enjoy it.

Here is an example result of the code ;

example_run.jpg

Enjoy & peace!

NOTE : This post won’t allow comments until it is shared more than 10 times in google plus from the button on the left!

We once had a homework way back when decided to share it. I edited this script which is in Matlab. I hope you like it. It simply is an analysis of AM and DSB-SC Modulation and Demodulation of a Periodic Square Wave.