Sie sind auf Seite 1von 9

Experiment No: 02

Course No:EEE 312 Group No: 05

Name of The Experiment: TIME DOMAIN ANALYSIS OF DISCRETE TIME SIGNALS AND
SYSTEMS

Date of performance: 08/06/'10 Name: Mohammad Zunaidur Rashid


Date of submission: 15/06/'10 Student No:0606071
Partner's student No:0606070
Department: EEE
Level:03 Term:02
Exercise A1:

clear all;
n=-7:7;
nd=2;
for i=1:length(n)
if(n(i)-nd>=0)
x(i)=n(i)-nd;
end
end
stem(n,x);

4.5

3.5

2.5

1.5

0.5

0
-8 -6 -4 -2 0 2 4 6 8
Exercise A2:
clear all;
x1=[0 1 2 3];
n1=0:3;
x2=[0 1 2 3];
n2=-1:2;
n=min(n1(1),n2(1)):max(n1(end),n2(end));
y1=zeros(1,length(n));
y2=y1;
y=y1;
for i=1:length(n)
if(n(i)>=n1(1)&&n(i)<=n1(end))
y1(i)=x1(find(n1==n(i)));
else y1(i)=0;
end
if(n(i)>=n2(1)&&n(i)<=n2(end))
y2(i)=x2(find(n2==n(i)));
else y2(i)=0;
end
end
y=y1+y2;
stem(n,y);

4.5

3.5

2.5

1.5

0.5

0
-1 -0.5 0 0.5 1 1.5 2 2.5 3
Exercise A3:
clear all;
clc;
L=3;
n=1:52;
for j=1:length(n)
x(j)=sin(0.36*j);
end
for i=1:length(n)
if((i/L)>floor(i/L))
y(i)=0;
else y(i)=x(i/L);
end
end
subplot(211),stem(n,x);
subplot(212),stem(n,y);

0.5

-0.5

-1
0 10 20 30 40 50 60

0.5

-0.5

-1
0 10 20 30 40 50 60
Exercise A4:
clear all;
clc;
n=-5:5;
nd=0;
for i=1:length(n)
if(n(i)-nd>=0)
x(i)=n(i)-nd;
end
end
xe=(x+fliplr(x))/2;
xo=(x-fliplr(x))/2;
subplot(2,1,1),stem(n,xe);
subplot(2,1,2),stem(n,xo);

2.5

1.5

0.5

0
-5 -4 -3 -2 -1 0 1 2 3 4 5

-2

-4
-5 -4 -3 -2 -1 0 1 2 3 4 5
Exercise B1:
clear all;
clc;
x1=[4 2 6 3 8 1 5];
n1=-2:4;
x2=[3 8 6 9 6 7];
n2=-4:1;
kmin=n1(1)+n2(1);
kmax=n1(end)+n2(end);
y=conv(x1,x2);
k=kmin:kmax;
for i=1:length(k)
if(k(i)>=n1(1)&&k(i)<=n1(end))
xk1(i)=x1(find(n1==k(i)));
else xk1(i)=0;
end
if(k(i)>=n2(1)&&k(i)<=n2(end))
xk2(i)=x2(find(n2==k(i)));
else xk2(i)=0;
end
end
subplot(311),stem(k,xk1);
subplot(312),stem(k,xk2);
subplot(313),stem(k,y);

10

0
-6 -4 -2 0 2 4 6
10

0
-6 -4 -2 0 2 4 6
200

100

0
-6 -4 -2 0 2 4 6
Exercise C1:
clear all;
clc;
b=1;
a=[1 0.6];
n=-10:20;
x1=(n==0);
x2=(n>=0);
x2=double(x2);
for i=1:length(n)
xt(i)=0.5*sin(i)
x3(i)=xt(i)*x2(i);
end
y1=filter(b,a,x1);
y2=filter(b,a,x2);
y3=filter(b,a,x3);
y4=conv(x2,y1);
y5=conv(x3,y1);
n1=(n(1)+n(1)):(n(end)+n(end));
subplot(321),stem(n,y1);
subplot(323),stem(n,y2);
subplot(324),stem(n,y3);
subplot(325),stem(n1,y4);
subplot(326),stem(n1,y5);

0.5

-0.5

-1
-10 -5 0 5 10 15 20
impulse response
1 0.5

0.5 0

-0.5
0 -10 -5 0 5 10 15 20
-10 -5 0 5 10 15 20
sinusoidal response
step response
1 0.5

0.5
0
0

-0.5 -0.5
-20 -10 0 10 20 30 40 -20 -10 0 10 20 30 40
step response using conv() sinusoidal response using conv()
Exercise C2:
clear all;
clc;
b=[1 0 -2];
a=[1 0.6];
n=-10:20;
x=(n>=0);
x=double(x);
ht=impz(b,a,n);
h1=transpose(ht);
y1=conv(h1,x);
n1=(n(1)+n(1)):(n(end)+n(end))
y2=filter(b,a,x);
subplot(211),stem(n1,y1);
subplot(212),stem(n,y2);

0.5

-0.5

-1

-1.5

-2
-20 -10 0 10 20 30 40
step response without using filter()

0.5

-0.5

-1

-1.5
-10 -5 0 5 10 15 20
step response by using filter()
Problem:
clear all;
clc;
f=50;
fs=1200;
ts=1/fs;
t=ts:ts:0.1;
x=sin(2*pi*f*t);
y=cos(2*pi*f*t+0.25*pi);
n=-(length(x)/2):((length(x)/2)-1);
x1=fliplr(x);
r=conv(x1,y);
n1=(n(1t)+n(1)):(n(end)+n(end));
te=find(r==max(r));
l=n1(te+1);
deg=((2*pi*f*(l*ts))*180)/pi
stem(n1,r)

Output:

deg =

-135.0000

>>

60

40

20

-20

-40

-60
-150 -100 -50 0 50 100 150

Das könnte Ihnen auch gefallen