0% found this document useful (0 votes)
18 views2 pages

DSP Lab

Uploaded by

Mahmud Sazzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

DSP Lab

Uploaded by

Mahmud Sazzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

function[x,n]=stepseq(n0,n1,n2)

n=n1:n2;
x=(n-n0)>=0;
end

function[x,n]=implse(n0,n1,n2)
n=n1:n2;
x=(n-n0)==0;
end

function[ye,yo,m]=evenodd(y,n)
m=n
ye=(1/2)*(y+fliplr(y));
yo=(1/2)*(y-fliplr(y));
end

ii & iii
n1=-5;
n2=5;
n=n1:n2;
h=0.6*stepseq(-2,n1,n2);
x=implse(-5,n1,n2)-implse(9,n1,n2)+stepseq(0,n1,n2)-stepseq(-10,n1,n2);
m=-5:0.5:5;
y=conv(x,h);
figure(1)
stem(n,x)
figure(2)
stem(m,y)

ye=evenodd(y,n)
figure(3)
stem(m,ye)
(iv)
f=210;
Fs=4*f;
Ts=1/Fs;
t=0 : 0.1*Ts : 3;
xa=10*sin(2*pi*f*t+20);
figure(1)
plot(t,xa)
n=0:0.1:3;
xn=10*sin(2*pi*f*n*Ts+20);
figure(2)
stem(n*Ts,xn)
M=600;
m=0:M;
w=pi*m/M;
Xw=xn*exp(-j*n'*w);
Xw=real(Xw);
w=[-fliplr(w),w(1:M)];
Xw=[-fliplr(Xw),Xw(1:M)];
figure(3)
plot(w/pi,Xw)
ASR=xn*sinc(Fs*(ones(length(n),1)*t-n'*Ts'*ones(1,length(t))));
figure(4)
plot(t,ASR)

a=[1, 2];
b=[2,3];
w=100;
[H,w]=freqz(b,a,w);
y=abs(H);
p=angle(H);
zplane(b,a)
plot(w/pi,y)
plot(w/pi,p)

z=xcorr(x,y)

You might also like