Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
UNIT IMPULSE
function [x,n]=impulse(n0,n1,n2)
n=[n1:n2];
x=[(n-n0)==0];
stem(n,x);
xlabel('n');ylabel('del[n]');
end
OUTPUT:
impulse(0,-10,10)
UNIT STEP
function [x,n]=unitstep(n0,n1,n2)
n=[n1:n2];
x=[(n-n0)>=0];
stem(n,x);
xlabel('n');ylabel('u[n]');
end
OUTPUT:
unitstep(0,-10,10)
1
RISHI
UNIT RAMP
function [x,n]=ramp(n0,n1,n2)
n=[n1:n2];
x=(n-n0).*[(n-n0)>=0];
stem(n,x);
xlabel('n');ylabel('r[n]');
end
OUTPUT:
ramp(0,-10,10)
2
RISHI
REAL EXPONENTIAL
function [x,n]=realexp(n0,n1,n2)
n=[n1:n2];
subplot(2,2,1)
x=2.^n;
stem(n,x);
title('a>1')
xlabel('n');ylabel('y[n]');
subplot(2,2,2)
x=0.5.^n;
stem(n,x);
title('0>a>1')
xlabel('n');ylabel('y[n]');
subplot(2,2,3)
x=(-0.5).^n;
stem(n,x);
title('-1<a<0')
xlabel('n');ylabel('y[n]');
subplot(2,2,4)
x=(-2).^n;
stem(n,x);
title('a<-1')
xlabel('n');ylabel('y[n]');
end
OUTPUT:
COMPLEX EXPONENTIAL
function [x,n]=complexexp(n0,n1,n2)
n=[n1:n2];
3
RISHI
x=exp((-0.1+(j*0.3)).*n);
subplot(2,2,1)
x1=real(x);
stem(n,x1);
title('REAL PART');
subplot(2,2,2)
x2=imag(x);
stem(n,x2);
title('IMAGINARY PART');
subplot(2,2,3)
x3=abs(x);
stem(n,x3);
title('MAGNITUDE');
subplot(2,2,4)
x4=(180/pi)*angle(x);
stem(n,x4);
title('PHASE');
end
OUTPUT:
complexexp(0,-10,10)
4
RISHI
x=2*(impulse(-2,n1,n2))-impulse(4,n1,n2)
stem(n,x);
end
OUTPUT:
sig2(-2,10)
[x2,n2]=(sigshift(x,[n2:n3],2))
n = min(min(n1),min(n2)):max(max(n1),max(n2));
y1=zeros(1,length(n));
y2=y1;
y3=y1;
y1(find((n>=min(n1))&(n<=max(n1))==1))= x1;
y2(find((n>=min(n2))&(n<=max(n2))==1))= x2;
y3(find((n>=min(n1))&(n<=max(n1))==1))= x;
6
RISHI
y = (y1)+(y3.*y2);
stem(n,y);
end
OUTPUT:
sig3(-2,10)
OR
7
RISHI
Z TRANSFORM
(i)X[n]=(1/4)^n u[n]
syms z n
ztrans((1/4)^n)
OUTPUT:
z/(z - 1/4)
(ii)
syms z n
ztrans(exp(-2*n))
OUTPUT:
z/(z - exp(-2))
Inverse Z transform
% X[z]=z/(z - 1/4)
syms z n
iztrans(z/(z - 1/4))
OUTPUT:
(1/4)^n
PROGRAM:
%Determine X3(z)=X1(z)X2(z)
x1=[1,2,3];
8
RISHI
n1=[-1:1];
x2=[2,4,3,5];
n2=[-2:1];
[x3,n3]=conv_mod(x1,n1,x2,n2)
OUTPUT:
x3 =2 8 17 23 19 15
n3 =-3 -2 -1 0 1 2
RESIDUEZ
1)1/((1+z^-1)*(1-z^-1)^2)
b=[1];
a=[1,-1,-1,1];
[R,p,C]=residuez(b,a)
[b,a]=residuez(R,p,C)
zplane(b,a)
OUTPUT:
R=
0.2500
9
RISHI
0.5000
0.2500
p=
1.0000
1.0000
-1.0000
C = []
b = 1.0000 0 0.0000
2)(3-4z^-1)/((1-0.5z^-1)^2*(1-3z^-1))
b=[3,-4];
a=[1,-4,13/4,(-3)/4];
[R,p,C]=residuez(b,a)
[b,a]=residuez(R,p,C)
zplane(b,a)
OUTPUT:
R =2.4000 + 0.0000i
10
RISHI
-0.4000 - 0.0000i
1.0000 + 0.0000i
p=
3.0000 + 0.0000i
0.5000 + 0.0000i
0.5000 - 0.0000i
C =[]
3)(1+z^-1)/((1-0.5z^-1)^2)(1-z^-1))
b=[1,1];
a=[1,-2,5/4,(-1)/4];
[R,p,C]=residuez(b,a)
[b,a]=residuez(R,p,C)
zplane(b,a)
R=
8.0000 + 0.0000i
-4.0000 - 0.0000i
11
RISHI
-3.0000 + 0.0000i
p=
1.0000 + 0.0000i
0.5000 + 0.0000i
0.5000 - 0.0000i
C = []
b=
a=
4) (3-4z^-1)/(1-3.5z^-1+1.5z^-2)
b=[3,-4];
a=[1,-3.5,1.5];
[R,p,C]=residuez(b,a)
[b,a]=residuez(R,p,C)
zplane(b,a)
12
RISHI
R=
p=
3.0000
0.5000
C =[]
b=
3 -4
DTFT OF x[n]={1,2,3,4,5}
x=[1,1,1,1];
n=0:3;
N=4;
X=dft(x,N);
magX=abs(X)
angX=angle(X)*180/pi
13
RISHI
subplot(2,1,1)
stem(n,magX);
title('MAGNITUDE PLOT')
xlabel('w')
ylabel('magX')
subplot(2,1,2)
stem(n,angX);
title('ANGLE PLOT')
xlabel('w')
ylabel('angX')
OUTPUT:
Find DTFT
x=[1,1,1,1];
n=0:3;
N=4;
k=0:500;
w=(2*pi/500)*k;
X=x*(exp(-j*2*pi/500)).^(n'*k);
magX=abs(X)
angX=angle(X)*180/pi
subplot(2,1,1)
plot(w,magX);
title('MAGNITUDE PLOT')
xlabel('w')
14
RISHI
ylabel('magX')
subplot(2,1,2)
plot(w,angX);
title('ANGLE PLOT')
xlabel('w')
ylabel('angX')
x=[1,1,1,1];
n=0:3;
N=4;
X=dft(x,N);
magX=abs(X)
angX=angle(X)*180/pi
subplot(2,1,1)
stem(n,magX);
title('MAGNITUDE PLOT')
xlabel('w')
ylabel('magX')
subplot(2,1,2)
stem(n,angX);
title('ANGLE PLOT')
xlabel('w')
ylabel('angX')
15
RISHI
16