You are on page 1of 39

D. J.

Sanghvi College of Engineering


Department of Electronics & Telecommunication Engineering

Experiment No:1 Date :

Aim Plot of Discrete Time signals

A. Plot the following discrete time signals using folding and shifting
property :
(i) 2nu(n)
(ii) 2n u(n-1)
(iii) 2n u(n+1)
(iv) 2n u(-n-1)
(v) 2n u(-n+1)

Apparatus SCILAB
Theory A signal is defined as any physical quantity that varies with time, space,
or any other independent variable or variables. Mathematically, we
describe a signal as a function of one or more independent variables.
For example, the functions
S1(t) = 5t
S2(t) = 20t2

describe two signals, one that varies linearly with the independent
variable t (time) and a second that varies quadratically with t.
Signals can be further classified into four different categories
depending on the characteristics of the time (independent) variable
and the values they take.
Continuous-time signals or analog signals are defined for every value
of time and they take on values in the continuous interval (a , b ) w
here a can be -∞ and b can be ∞. Mathematically, these signals can be
described by functions of a continuous variable. The speech
waveforms are shown in figure below

1
D. J. Sanghvi College of Engineering
Department of Electronics & Telecommunication Engineering

Experiment No:1 Date :

Discrete-time signals are defined only at certain specific values of time.


These time instants need not be equidistant, but in practice they are
usually taken at equally spaced intervals for computational convenience
and mathematical tractability . The signal x(n) = 0.8n n = 0, ± 1 , ± 2 ,
. . . provides an example of a discrete -time signal. If we use the index
n of the discrete-time instants as the independent variable, the signal
value becomes a function of an integer variable (i.e., a sequence of
numbers). Thus a discrete-time signal can be represented
mathematically by a sequence of real or complex numbers. To
emphasize the discrete-time nature of a signal, we shall denote such a
signal as x(n) instead of x(t). If the time instants t are equally spaced
(i.e t = nT ), the notation x (n T) is also used. For example, the following
sequences are examples of
Step function
Ramp function
Impulse function
Exponential function
Sine function
Cosine function

2
D. J. Sanghvi College of Engineering
Department of Electronics & Telecommunication Engineering

Experiment No:1 Date :

Results
and On completion of this experiment we were successfully in implement
discussions different discrete signals. We plotted signals using SCILAB software.

3
izkzz
N=4;
x=[1,2,3,4];
for k=1:N
t=0
for n=1:4
t=t+x(n)*exp(((-1)*sqrt(-1)*2*%pi*(k-1)*(n-1))/N)
end
disp(round(t))
plot2d3(k,abs(t))
end
a=gca()
a.data_bounds=[0,0;5,10]
plot2d3(k,abs(t))
Sujal Shah - 60002210073

DSP EXP – 3
Aim - To implement circular convolution in SCILAB

clear all;
a1=[1,2,3,4];
b1=[1,2,2,1];
N=4
for r=1:N
y(r)=0;
for i=1:N
j=r-i+1;
if j<=0 then
j=j+N;
end
y(r)=y(r)+a1(j)*b1(i);
end
end
disp(y);
Sujal Shah - 60002210073

TO PLOT THE GRAPH

clear all;
a1=[1,2,3,4];
b1=[1,2,2,1];
N=4
for r=1:N
y(r)=0;
for i=1:N
j=r-i+1;
if j<=0 then
j=j+N;
end
y(r)=y(r)+a1(j)*b1(i);
end
end
disp(y);
a=gca();
a.data_bounds=[0,0;5,10];
plot2d3(y);

OUTPUT:
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


implement Circular Convolution in SCILAB.
Sujal Shah - 60002210073

DSP EXP – 4
Aim - To synthesize SA RE GA MA PA in MATLAB

clc;
close all;
clear all;
f=[245 254 302 320 358.5 380 451 470];
fs=8000;
n=8;
N=1:4000;
temp=[];
for i=1:n
y=sin(2*3.14*(f(i)/fs)*N)
temp=[temp y]
disp(temp)
end
sound(temp,fs)

Conclusion – On successful completion of this experiment we were able to


synthesize SA RE GA MA in MATLAB.
Sujal Shah - 60002210073
Sujal Shah - 60002210073

DSP EXP – 5
Aim - To find frequency response of an audio signal.

Code:
N=2000;
t=0:1:2000;
[y fs]=wavread('my-hat.wav',[6000 8000]);
figure(1)
plot(t,y);
ft=fft(y);
figure(2)
k=0:2000;
plot(k,abs(ft));
figure(3);
plot((fs/N)*k,abs(ft));

OUTPUT 1(Time vs Freq)


Sujal Shah - 60002210073

OUTPUT 2(SAMPLE NO(K),AMPLITUDE)

OUTPUT 3(FREQUENCY IN Hz,AMPLITUDE)


Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


find frequency response of an audio signal.
Sujal Shah - 60002210073

DSP EXP – 6
Aim – To remove noise by FIR Filter

Code:
t=linspace(0,2,1000);
x=sin(2*pi*t);
noisy_signal=awgn(x,10)
subplot(3,1,1);plot(t,x);
subplot(3,1,2);plot(t,noisy_sig
nal); a=1; b=1/50*ones(1,50);
y=filter(b,a,noisy_signal);
subplot(3,1,3);plot(t,y);
Sujal Shah - 60002210073

t=linspace(0,2,1000);
x=sin(2*pi*t);
noisy_signal=awgn(x,10)
subplot(3,1,1);plot(t,x);
subplot(3,1,2);plot(t,noisy_sig
nal); a=1; b=1/5*ones(1,5);
y=filter(b,a,noisy_signal);
subplot(3,1,3);plot(t,y);
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


remove noise by FIR filter.
Sujal Shah - 60002210073

DSP EXP – 7
Aim – To Design a low pass Analog Butterworth filter.

Code:
fs=2400Hz;
fp=1200Hz;
fsamp=10000Hz;
f1=2*fp/fsamp;
f2=2*fs/fsamp;
ap=2db;
as=60db;
[n,Wn]=buttord(f1,f2,ap,as);
[b,a]=butter(n,Wn,'low');
W=0:0.1:pi;
[h,om]=freqz(b,a,W);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);plot(om/pi,m);
subplot(2,1,2);plot(om/pi,an);
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


design low pass Analog Butterworth filter.
Sujal Shah - 60002210073

DSP EXP – 8
Aim – To Design a High pass Analog Butterworth filter.

Code:
fs=1200;
fp=2400;
fsamp=5000;
w1 = fs/fsamp;
w2 = fp/fsamp;
ap=2;
as=60;
[n,Wn]=buttord(w1,w2,ap,as);
[b,a]=butter(n,Wn,'high');
w=0:0.1:pi;
[h,om]=freqz(b,a,w);
m=20*log(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,2);
plot(om/pi,an);
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


design high pass Analog Butterworth filter.
Sujal Shah - 60002210073

DSP EXP – 9
Aim – To implement FIR filter with given specifications.

Code:
N=31;
n=-15:15;
hd=0.25*sinc(pi*n/4);
w=hamming(N,'symmetric');
h=hd.*w';
figure(1);
stem(n,hd,'black');
hold on;
stem(n,h,'red');
title("Impulse Response of the designed filter");
xlabel('n');
ylabel('Amplitude');
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


implement FIR filter with given specifications
Sujal Shah - 60002210073

DSP EXP – 10
Aim – Generation of Sine Wave with DSP Processor TM6713

Code:
Sujal Shah - 60002210073
Sujal Shah - 60002210073
Sujal Shah - 60002210073

Conclusion – On successful completion of this experiment we were able to


generate Sine Wave with DSP Processor TM6713.

You might also like