DSP Lab Experiments
DSP Lab Experiments
Result:
Experiment 2
Code:
n=-4:4;
delta_n=[zeros(1,4) 1 zeros(1,4)];
stem(n,delta_n);
xlabel("time sample");
ylabel("amplitude");
Result:
Experiment 3
Name: unit impulse signal
Code:
n=-4:4;
delta_n= n==0;
stem(n,delta_n);
xlabel("time sample");
ylabel("amplitude");
Result:
Experiment 4
Code:
n=-4:4;
unit=n>=0;
stem(n,unit);
xlabel("time sample");
ylabel("amplitude");
Result:
Experiment 5
Equation: delta(n)=U(n)-U(n-1)
Code:
n=-20:20;
unit1=n>=0;
subplot(3,1,1);
stem(n,unit1);
xlabel("time sample");
ylabel("amplitude");
axis([-10 10 -4 4]);
unit2=n>=1;
subplot(3,1,2);
stem(n,unit2);
xlabel("time sample");
ylabel("amplitude");
axis([-10 10 -4 4]);
unit=unit1-unit2;
subplot(3,1,3);
stem(n,unit);
xlabel("time sample");
ylabel("amplitude");
axis([-10 10 -4 4]);
Result:
Experiment 6
Name: unit ramp signal
Equation: a(n)=U(n)*n
Code:
n=-20:20;
unit1=n>=0;
subplot(3,1,1);
stem(n,unit1);
xlabel("time samples ");
ylabel("amplitude");
axis([-10 10 -5 5]);
unit2=n;
subplot(3,1,2);
stem(n,unit2);
xlabel("time samples ");
ylabel("amplitude");
axis([-10 10 -5 5]);
unit=unit1.*unit2;
subplot(3,1,3);
stem(n,unit);
xlabel("time samples");
ylabel("amplitude");
axis([-10 10 -5 5]);
Result:
Experiment 7
Code:
n=(-20:20);
x_n=2.*(1.2.^n);
stem(n,x_n);
xlabel("time sample");
ylabel("amplitude");
Result:
Experiment 8
ID: B160305002
X(n)=e^[(-0.1+0.3j)n]
Code:
n=-20:20;
m=-0.1+0.3j;
x_n=exp(m.*n);
subplot(4,1,1);
stem(n,real(x_n));
xlabel("time sample");
ylabel("real part");
subplot(4,1,2);
stem(n,imag(x_n));
xlabel("time sample");
ylabel("imaginary part");
subplot(4,1,3);
stem(n,abs(x_n));
xlabel("time sample");
ylabel("magnitude part");
subplot(4,1,4);
stem(n,angle(x_n));
xlabel("time sample");
ylabel("phase part");
Result:
Lab-05:For the complex exponential signal x(n)=e^[(-.1+.3j)n],find the real part,
imaginary part, magnitude and phase.
Lab-06: Realization of the periodic signal cos((3*pi/7)*n).
Lab-07: For the Z-transformation of x(n)=(.8)^n U(n) find the frequency response.
Lab-08: For the Z-transformation of x(n)=(.8)^n U(-n-1) find the frequency response.
W=0:.01:2*pi;
a=[1];
b=[-1,.8];
h_n=freqz(a,b,W);
subplot(2,2,1);
plot(W/pi,real(h_n));
subplot(2,2,2);
plot(W/pi,imag(h_n));
subplot(2,2,3);
plot(W/pi,angle(h_n));
Lab-09: For the Z-transformation of x(n)=cos(w 0n) U(n) find the frequency response.
W=0:.01:2*pi;
a=[1];
b=[1,.67];
h_n=freqz(a,b,W);
subplot(2,2,1);
plot(W/pi,real(h_n));
subplot(2,2,2);
plot(W/pi,imag(h_n));
subplot(2,2,3);
plot(W/pi,angle(h_n));