Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

DIGITAL SIGNAL

PROCESSING
Assignment -1 (Date: 01/08/2016)

Submitted By: Ashwin Sathian


B140054EC

1. The highest rate of oscillation in a discrete-time sinusoid is obtained when = or


equivalently, f=1/2
Illustration: Consider x(n)=cos0n in the frequency range 0 to
Let 0=0, /8, /4, /2, or equivalently f=0, /16, 1/8, , , which results in periodic
sequence having periods=, 16, 8, 4, 2. We see that period of the sinusoid decreases
while rate of oscillation increases with increasing frequency. However, this isnt the
case when 0 goes from to 2. As we increase the relative frequency in this range,
rate of oscillation decreases in such a way that the state at 0=2 is the same as at
0=0. Hence, we can conclude that t he highest rate of oscillation in a discrete-time
sinusoid is obtained when = or equivalently, f=1/2
2. We know that discrete-time sinusoidal signals with frequencies separated by 2 are
identical and hence, any such interval will constitute all the DT sinusoids or complex
exponentials. This finite frequency range, usually 0 2 or alternatively -
, is known as Fundamental Range.
3. The following plots were obtained from MATLAB as per the given specifications. The

corresponding MATLAB instructions are also given below. Here, one of the sample
frequencies 3kHz, is less than the Nyquist condition requirement. Hence, the first
plot shows an undersampled signal.
% Sample the sinusoid x = sin(2 pi f t), where f = 2 kHz.
% Let x1 be the signal sampled at 3 kHz.
% Let x2 be the signal sampled at 5 kHz.
f = 2000;
T = 1/f;
tmin = 0;
tmax = 5*T;

% Plot 5 cycles

dt1 = 1/3000;
dt2 = 1/5000;
t1 = tmin:dt1:tmax;
t2 = tmin:dt2:tmax;
x1 = sin(2*pi*f*t1);
x2 = sin(2*pi*f*t2);
subplot(211)
stem(t1,x1);
subplot(212)
stem(t2,x2);
4. The plot from MATLAB, and the adjoining code are as follows:
%

Sample the sinusoid x = sin(2 pi f t), where f = 2 kHz, and


plot the sampled
% signals over the continuous-time signal.
% Let x1 be the signal sampled at 10 kHz.
% Let x2 be the signal sampled at 3 kHz.
f = 2000;
T = 1/f;
tmin = 0;
tmax = 5*T;
dt = T/100;
dt1 = 1/10000;
dt2 = 1/3000;
t = tmin:dt:tmax;

t1 = tmin:dt1:tmax;
t2 = tmin:dt2:tmax;
x = sin(2*pi*f*t);
x1 = sin(2*pi*f*t1);
x2 = sin(2*pi*f*t2);
subplot(211)
plot(t,x,'r');
hold on
stem(t1,x1);
subplot(212)
plot(t,x,'r');
hold on
stem(t2,x2);
In this question, we see that the sampled signals are peculiar they coincide exactly as one.
This,
is

because the signal frequencies 1/8Hz and -7/8Hz are both equidistant about 1Hz, the
sampling frequency. A couple of other examples would be signals having frequencies and 3/4 sampled at 1Hz, and signals with frequencies 5/3 and -1/3 sampled at 2Hz.
f1 = 1/8;
f2= -7/8;
T1 = 1/f1;
T2 =1/f2;
tmin = 0;
t1max = 4*T1;
t2max =-28*T2;
dt = 1;

ts1 = tmin:dt:t1max;
ts2 = tmin:dt:t2max;
x1s = 3*sin(2*pi*f1*ts1);
x2s = 3*sin(2*pi*f2*ts2);
t=0:0.00001:2*T1;
x1=3*sin(2*pi*f1*t);
x2=3*sin(2*pi*f2*t);
subplot(4,1,1);
stem(ts1,x1s),title('Both
Overlapped'),xlabel('t'),ylabel('A');hold on
stem(ts2,x2s,'k')
subplot(4,1,2);
stem(ts1,x1s),title('Sampling Freq
1/8'),xlabel('t'),ylabel('A');
subplot(4,1,3);
stem(ts2,x2s,'k'),title('Sampling Freq 7/8'),xlabel('t'),ylabel('A');
subplot(4,1,4);
plot(t,x1);hold on
plot(t,x2);hold on
stem(ts1,x1s);hold on
stem(ts2,x2s,'k'),title('All'),xlabel('t'),ylabel('A')

6.

f = 2000;
T = 1/f;
tmin = 0;
tmax = 5*T;
dt1 = 1/15000;
t1 = tmin:dt1:tmax;
x1 = 3*sin(2*pi*f*t1);
t=0:0.00001:0.0025;
x=3*sin(2*pi*f*t);
dv=(3/4);
partition = [-3:dv:3];
codebook = [-3-(dv/2):dv:(3+(dv/2))];
[index,quantized] = quantiz(x1,partition,codebook);
stem(t1,quantized),title('Digitalized Signal'),xlabel('time-->'),ylabel('amplitude--->'),grid on;hold on
plot(t,x)
error=immse(x1,quantized)

You might also like