Home Work 07 Eee221l

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

HOME WORK-07

EEE-221. LAB
FARHANA ISLAM
1912648643
SECTION -02

Answer-01
Answer-02

%Farhana Islam
%1912648643

clc;clear all;
x = [3 11 7 0 -1 4 2];
h = [2 3 0 -5 2 1];
g = conv(x,h)

subplot(3,1,1)
stem(x,'b','linewidth',3);
grid on;

subplot(3,1,2)
stem(h,'r','linewidth',3);
grid on;

subplot(3,1,3)
stem(g,'kv','linewidth',3);
grid on;

Answer-03

%Farhana Islam
%1912648643

clc;clear all;
x = [6 1 7 0 -9 4 12];
h = [6 0 10 -5 4 8];
y = conv(x,h)

subplot(3,1,1)
stem(x,'b','linewidth',3);
grid on;
subplot(3,1,2)
stem(h,'r','linewidth',3);
grid on;

subplot(3,1,3)
stem(y,'kv','linewidth',3);
grid on;

Answer-04

%Farhana Islam
%1912648643

clc;clear all;
n = [3 11 7 0 -1 4 2];
nh = [-3:1:3];
h = [2 3 0 -5 2 1];
hh = [-1:1:4]

gy1 = nh(1)+hh(1);
gy2 = nh(end)+hh(end);
gh = gy1:1:gy2;
g = conv(n,h)

subplot(3,1,1)
stem(nh,n,'b','linewidth',3);
grid on;xlim([-4 8])

subplot(3,1,2)
stem(hh,h,'r','linewidth',3);
grid on;xlim([-4 8])

subplot(3,1,3)
stem(gh,g,'kv','linewidth',3);
grid on;xlim([-4 8])

Answer-05

%Farhana Islam
%1912648643

clc;clear all;
n = [2 6 0 -9 6 3];
nh = -3:1:2;
h = [1 0 15 -6 4 7];
hh = -2:1:3;
g = conv(n,h)
gh1 = nh(1)+hh(1);
gh2 = nh(end)+hh(end);
gh = gh1:1:gh2;

subplot(3,1,1)
stem(nh,n,'b','linewidth',3);
grid on;xlim([-5 5])

subplot(3,1,2)
stem(hh,h,'r','linewidth',3);
grid on;xlim([-5 5])

subplot(3,1,3)
stem(gh,g,'kv','linewidth',3);
grid on;xlim([-5 5])

Answer-06

%Farhana Islam
%1912648643

clc;clear all;
x = [3 11 7 0 -1 5 2];
xh = -3:1:3;

gh1 = xh(1)+xh(1);
gh2 = xh(end)+xh(end);
gh = gh1:1:gh2;

g = conv (x,x)

subplot(3,1,1)
stem(xh,x,'b','linewidth',3);
grid on;xlim([-6 6])

subplot(3,1,2)
stem(xh,x,'r','linewidth',3);
grid on;xlim([-6 6])

subplot(3,1,3)
stem(gh,g,'kv','linewidth',3);
grid on;xlim([-6 6])

Answer-07
%Farhana Islam
%1912648643

clc;clear all;
x = [3 11 7 0 -1 5 2];
xh = -3:1:3;
h = [2 3 0 -2 2 1];
hh = -1:1:4;

g = conv(x,h)
gh1 = xh(1)+hh(1);
gh2 = xh(end)+hh(end);
gh = gh1:1:gh2;

subplot(3,1,1)
stem(xh,x,'b','linewidth',3);
grid on;xlim([-4 7])

subplot(3,1,2)
stem(hh,h,'r','linewidth',3);
grid on;xlim([-4 7])

subplot(3,1,3)
stem(gh,g,'kv','linewidth',3);
grid on;xlim([-4 7])
Answer-08

%Farhana Islam
%1912648643

clc;clear all;
x = [1 2 3 4 5 6 7 6 5 4 3 2 1];
xh = -2:1:10;
hh = -5:1:5;
h = hh;

gh1 = xh(1)+hh(1);
gh2 = xh(end)+hh(end);
g = conv (x,h)
gh = gh1:1:gh2;

subplot(3,1,1)
stem(xh,x,'b','linewidth',3);
grid on;xlim([-7 15])

subplot(3,1,2)
stem(hh,h,'r','linewidth',3);
grid on;xlim([-7 15])
subplot(3,1,3)
stem(gh,g,'kv','linewidth',3);
grid on;xlim([-7 15])

Answer-09

%Farhana Islam
%1912648643

clc;clear all

f = 1;
t = -0.1:0.01:0.1;
x = sin(2*f*t);
h = cos(2*f*t);

y = conv(x,h)
yt1 = t(1)+t(1);
yt2 = t(end)+t(end);
yt = yt1:0.01:yt2;

subplot(3,1,1)
stem(t,x,'b','linewidth',1);
grid on;xlim([-0.2 0.2])
subplot(3,1,2)
stem(t,h,'r','linewidth',1);
grid on;xlim([-0.2 0.2])

subplot(3,1,3)
stem(yt,y,'kv','linewidth',1);
grid on; xlim([-0.2 0.2])

Answer-10

%Farhana Islam
%1912648643

clc
clear all
t=0:.001:2;
h=(t>0)-(t>2);
x=(t>0)-(t>1);

[y]=conv(x,h);

subplot(3,1,1)
plot(t,h,'b','linewidth',2);
grid on;
xlim([-2 6]);
title('system responsr,h(t)');

subplot(3,1,2)
plot(t,x,'r','linewidth',2);
grid on;
xlim([-2 6]);
title('input signal,x(t)');

subplot(3,1,3)
plot(0:0.001:4,y,'k','linewidth',2);
grid on;
xlim([-2 6]);
title('system output,y(t)');

Answer-11

%Farhana Islam
%1912648643

clc
clear all
t=-10:.01:10;
x1=-2.*exp(t).*(t<0);
x2=2.*exp(-t).*(t>=0);
f=x1+x2;
g=(t>=0);
c=conv(f,g);

subplot(3,1,1)
plot(t,f,'b','linewidth',2);
grid on;
axis([-10 10 -2 2]);
title('input signal,f(t)');

subplot(3,1,2)
plot(t,g,'r','linewidth',2);
grid on;
axis([-10 10 -2 2]);
title('input response,g(t)');

subplot(3,1,3);
plot(-20:0.01:20,c,'k','linewidth',2);
grid on;
axis([-20 20 -500 500]);
title('system output,c(t)');

You might also like