Digital Signal Processing Reference
In-Depth Information
in which the first row is the binary representation of the first number in the vector of decimal numbers to
be converted (17 in this case), and so forth. The leftmost bit of each row is the sign bit; positive numbers
have "0" for a sign bit, and negative numbers have a "1."
14. Write a script that conforms to the following call syntax
BinOut
=
LV xBinaryCodeMethods(BitsQ,SR,Bias,Freq,Amp,CM,PlotType)
as described in the text and below:
function BinOut = LVxBinaryCodeMethods(BitsQ,SR,Bias,Freq,...
Amp,CodeMeth,PlotType)
% Quantizes a sine wave of amplitude Amp and frequency
% Freq using BitsQ number of quantization bits at a sample
% rate of SR.
% Bias: 0 for none, 1 for 1/2 LSB
% CodeMeth:1=Sign+Mag; 2 = Offset;
% PlotType: val 0 plot as multiples of LSB, or 1 to plot in volts
% Generates a figure with three subplots, the first is the
% (simulated) analog test signal, the second has an overlay
% of the simulated test signal and its quantized version, and the
% third is the quantization error
% Test calls:
% BinOut = LVxBinaryCodeMethods(4, 1000,0, 10,170,2,0)
% BinOut = LVxBinaryCodeMethods(2, 1000,0, 10,170,1,1)
% BinOut = LVxBinaryCodeMethods(3, 1000,1, 10,170,1,1)
15. Write the m-code for the script
LVxInterpolationViaSinc ( N,SampDecRate,valTestSig )
which conforms to the syntax below, functions as described in the text, and which creates plots as shown
in the text. Test it with the given sample calls:
function LVxInterpolationViaSinc(N,SampDecRate,valTestSig)
% N is the master sequence length, from which a densely-sampled
% test signal is generated. The master sequence is decimated by
% every SampDecRate samples to create the test sample
% sequence from which an interpolated version of the underlying
% bandlimited continuous domain signal will be generated.
% N must be an even integer, and SampDecRate must be an
% integer; valTestSig may be any integer from 1 to 5, such that
% 1 yields the waveform cos(2*pi*n*0.1) + 0.7*sin(2*pi*n*0.24);
% 2 yields DC
% 3 gives a single triangular waveform
% 4 gives two cycles of a triangular waveform
% 5 gives 0.5*cos(2*pi*n*0.125) + 1*sin(2*pi*n*0.22);
% where n = -N/2:1:N/2 if N is even
% Sample calls:
Search WWH ::




Custom Search