Professional Documents
Culture Documents
Lab 3
Lab 3
22002705 Section- 1
BILKENT UNIVERSITY
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EEE 321
Signals and Systems
Lab Assignment 3
PART 1
1.1
1.2
1
Melih Kutay Yağdereli
22002705 Section- 1
This system still holds the Time Invariance and Causality properties while also having the BIBO
stability because of the decaying exponential term being present
1.3
This system is the discretization or “quantization” of the ideal integrator it is called "discrete-
time integrator" or a "digital integrator."
Ts = 0.01;
M=100;
T = [-M: Ts : M];
2
Melih Kutay Yağdereli
22002705 Section- 1
y = zeros(size(T));
x = step; %the step response of exponational integrator
y(1) = x(1);
for i = (length(T)-1)/2:length(T)-1
y(i) = (1-exp(-a*T(i)))/a; %derived in part 1.2
end
s1 = y;
subplot(2,2,1)
plot(T,h);
xlabel('t')
ylabel("h(t)")
title("Impulse Response of Ideal Integrator")
grid("on")
ylim([-0.25 1.25])
subplot(2,2,2)
plot(T,s);
xlabel('t')
ylabel("s(t)")
title("Step Response of Ideal Integrator")
grid("on")
ylim([-1000 10000])
subplot(2,2,3)
plot(T,h1);
3
Melih Kutay Yağdereli
22002705 Section- 1
xlabel('t')
ylabel("h1(t)")
title("Impulse Response of exponantional Integrator")
grid("on")
subplot(2,2,4)
plot(T,s1);
xlabel('t')
ylabel("s1(t)")
title("Step Response of exponantional Integrator")
grid("on")
The code for the Part 1.3
PART 2
The Bibo stability test should gave an
function [sum_array] = sumElements(h, N_range)
% initialize arrays
sum_array = zeros(size(N_range));
T = -N_range(end) : 0.01 : N_range(end);
%sum algorythm
for i = 1 : length(N_range)
%specify the length of the arrays for spesific N value
Ti = -N_range(i) : 0.01 : N_range(i);
y = zeros(size(Ti));
h1 = h(T>=-N_range(i) & T<=N_range(i));
% for the spesific N value do the summation
y(1) = h1(1);
for n = 2 : length(Ti)
y(n) = abs(h1(n-1)) + y(n-1) ;
4
Melih Kutay Yağdereli
22002705 Section- 1
end
%save the result
sum_array(i) = y(end);
end
end
The Code for the SumElements Function
T = [-10000 : 0.01 : 10000];
N_range = [100 : 300 :10000];
%initialize the array size
h = zeros(size(T));
k= 0;
%for all a values given in the report
for a = [0, 0.05, 0.1, 0.25, 0.5];
%create the h(t) function for the given a value
for i = (length(T)-1)/2 : length(T)
h(i) = exp(-a*T(i));
end
%plot the sum of the h(t) functions
k = k + 1;
subplot(3,2,k)
plot(T,h)
results = sumElements(h,N_range);
plot(N_range,results)
xlabel('N range')
ylabel("Absolute Sum of h(t)")
title("Absolute sum of h(t) for a ="+a+"")
grid("on")
end
5
Melih Kutay Yağdereli
22002705 Section- 1
PART 3
T = -50 : 0.01 : 50;
T2 = -100 : 0.01 : 100;
x1 = zeros(size(T));
x2 = zeros(size(T));
y = zeros(size(T)); %y function initialize
%%
k = 0;
for a = [0, 0.05, 0.1, 0.25, 0.5];
h = zeros(size(T));
for i = (length(T)-1)/2:length(T)-1
h(i) = exp(-a*T(i));
end
y1 = ConvFUNC(x1,h);
k = k+1;
subplot(5,1,k)
plot(T2,y1)
xlabel('time')
6
Melih Kutay Yağdereli
22002705 Section- 1
ylabel("y1(t)")
title("y1(t) for a ="+a+"")
grid("on")
end
%%
k = 0;
for a = [0, 0.05, 0.1, 0.25, 0.5];
h = zeros(size(T));
for i = (length(T)-1)/2:length(T)-1
h(i) = exp(-a*T(i));
end
y1 = ConvFUNC(x2,h);
k = k+1;
subplot(5,1,k)
plot(T2,y1)
xlabel('time')
ylabel("y2(t)")
title("y2(t) for a ="+a+"")
grid("on")
end
a =0;
for i = (length(T)-1)/2:length(T)-1
h(i) = exp(-a*T(i));
end
%%
y1ideal = ConvFUNC(x1,h);
y2ideal = ConvFUNC(x2,h);
%%
k = 0;
for a = [0.05, 0.1, 0.25, 0.5];
h = zeros(size(T));
for i = (length(T)-1)/2:length(T)-1
h(i) = exp(-a*T(i));
end
y1 = ConvFUNC(x1,h);
delta1 = abs(y1ideal -y1);
k = k+1;
subplot(5,1,k)
plot(T2,delta1)
xlabel('time')
ylabel("delta1(t)")
title("delta1(t) for a ="+a+"")
grid("on")
end
%%
k = 0;
for a = [0.05, 0.1, 0.25, 0.5];
h = zeros(size(T));
for i = (length(T)-1)/2:length(T)-1
h(i) = exp(-a*T(i));
end
7
Melih Kutay Yağdereli
22002705 Section- 1
y2 = ConvFUNC(x2,h);
delta2 = abs(y2ideal -y2);
k = k+1;
subplot(5,1,k)
plot(T2,delta2)
xlabel('time')
ylabel("delta2(t)")
title("delta2(t) for a ="+a+"")
grid("on")
end
%%
The Code for the Part 2
8
Melih Kutay Yağdereli
22002705 Section- 1
9
Melih Kutay Yağdereli
22002705 Section- 1
PART 4:
By doing the same procedure twice we obtain
x = delta;
for i = 3: length(T)
y(i) = x(i) - 2*x(i-1) + x(i-2);
end
h = y;
% stem(T,h)
% axis([-2 2 -3 2])
% grid("on")
N = 0:1:5;
result = sumElements(h,N);
stem(N,result)
10
Melih Kutay Yağdereli
22002705 Section- 1
11