Professional Documents
Culture Documents
Terminal Question# 01 (A) : 'Linear Convolution' On
Terminal Question# 01 (A) : 'Linear Convolution' On
Question# 01
(a)
x=[1 2 3 4];
h=[5 4 3 1];
a=length(x);
b=length(h);
linear_convolution=conv(x,h);
subplot(5,1,1)
stem(linear_convolution)
title('linear convolution')
grid on;
h=[h zeros(1,length(h)-1)];
x=[x zeros(1,length(x)-1)];
circular_convolution=cconv(h,x);
subplot(5,1,2)
stem(circular_convolution)
title('circular convolution')
grid on;
Error= abs(linear_convolution - circular_convolution)
Figure:
linear convolution
40
20
0
40
4
circular convolution
20
0
Question #01
(b)
10
12
14
t=0:.1:10;
x=sin(t);
subplot(5,1,1)
plot(t,x);
xlabel('t(seconds)');
ylabel('x(t)');
title('sinusoid signal')
grid on;
%length=(reg.number/10)*100=1050;
s=randn(length(1050));
x1=x+s;
subplot(5,1,2)
plot(t,x1);
xlabel('t(seconds)');
ylabel('x1(t)');
title('Noise added in signal')
grid on;
b=filter(x,1,x1);
d=b/length(x1);
subplot(5,1,3)
plot(t,d);
xlabel('t(seconds)');
ylabel('d(t)');
title('Recovered signal using moving average
filter')
grid on;
Figure:
sinusoid signal
x(t)
1
0
-1
x1(t)
1
d(t)
10
10
10
2
0
5
6
t(seconds)
Recovered signal using moving average filter
0
-1
Question #02
(a),(b),(c),(d),(e),(f),(g)
R=105;
n=0:105;
5
t(seconds)
Noise added in signal
5
t(seconds)
x=4*(0.1.^n).*(heaviside(n)-heaviside(n-105))
h=freqz(x,n);
subplot(5,1,1)
stem(h);
xlabel('n(seconds)');
ylabel('h(jw)');
title(' DTFT signal')
grid on;
h1=abs(h);
subplot(5,1,2)
stem(h1);
xlabel('n(seconds)');
ylabel('h1(jw)');
title('magnitude of DTFT signal')
grid on;
h2=angle(h);
subplot(5,1,3)
stem(h2);
xlabel('n(seconds)');
ylabel('h2(jw)');
title('Angle of DTFT signal')
grid on;
h3=real(h);
subplot(5,1,4)
stem(h3);
xlabel('n(seconds)');
ylabel('h3(jw)');
title('Real part of DTFT signal')
grid on;
h4=imagi(h);
subplot(5,1,5)
stem(h4);
xlabel('n(seconds)');
ylabel('h4(jw)');
title('Real part of DTFT signal')
grid on;
t=exp((-1i*2*pi)*x(n));
h=freqz(x,n);
h0=2;
h5=(h-h0);
Figure:
DTFT signal
h(jw)
0.05
0
h1(jw)
-0.05
100
200
300
n(seconds)
magnitude of DTFT signal
400
500
600
100
200
300
n(seconds)
Angle of DTFT signal
400
500
600
100
200
300
n(seconds)
Real part of DTFT signal
400
500
600
100
200
300
n(seconds)
400
500
600
0.04
0.02
h2(jw)
5
0
-5
h3(jw)
0.05
0
-0.05
Question# 03
clc
clear all
wp=0.3*pi;
ws=0.45*pi;
w0=(wp+ws)/2;
delta_w=abs(wp-ws);
N=ceil(5,6*pi/delta_w);
hd=id_lp(wo,N);
h=hamming(N);
hf=hd.*h;
plot(hf);
title('hf')
grid on;
wp=0.3*pi;
ws=0.45*pi;
Rp=0.25;
As=52;
wc=(wp+ws)/2;
fc=wc/2;
b=pi/2;
b1=filter(wc,As,Rp);
h=freqz(b1);
delta_w=wp-ws;
M=7.95*As/14
alpha=M-1/2;
N=ceil(6,6*pi/delta_w);
h=hammingn