Professional Documents
Culture Documents
Question 1
Suppose you are given the following system discrete system with the input x(t) and the system
response h(t) (40 Marks)
Where,
x(n)=[ 1 -1.5 2 -0.75 3 -2 0.5]
h(n)=[-1 0 0.5 2.5 1]
a. Find the output of the system y(n) by using the convolution and compare the results by solving the
convolution in Fourier domain. Are the results same in both domain?
b. Plot the magnitude and phase of the system response i.e. h(n)
Answer:
x=[1,2,1,2,1,1];
h=[1,2,-1,1,3];
y=conv(x,h);
subplot(311);stem(x);title('Input Signal');
subplot(312);stem(h);title('Impulse Response');
subplot(313);stem(y);title('output Signal');
_n=-1:3;
y=1:5;
k=0:500;
w=(pi/500)*k;
x=y*exp(-j*pi/500).^(n'*k);
magx=abs(x);
angx=angle(x);
realx=real(x);
imagx=imag(x);
subplot(221);
plot(w/pi,magx);
grid;
xlabel('frequency in pi units')
ylabel('Magnitude')
title('Absolute Value');
subplot(222);
plot(w/pi,imagx);
grid;
xlabel('frequency in pi units')
ylabel('Magnitude')
title('Imaginary value');
subplot(223);
plot(w/pi,realx);
grid;
xlabel('frequency in pi units')
ylabel('Magnitude')
title('real value');
subplot(224);
plot(w/pi,angx);
grid;
xlabel('frequency in pi units')
ylabel('Magnitude')
Question 2
Take two different sounds from the Matlab library (60 Marks)
Code:
[Y,fs]=audioread('C:\Users\student\Desktop\taha.wav');
time=(1/fs)*length(Y);
t=linspace(0,time,length(Y));
plot(t,Y)
load handel
sound(y,Fs);
time=(1/Fs)*length(y);
t=linspace(0,time,length(y));
plot(t,y)
this figure:
Code:
[Y,fs]=audioread('C:\Users\student\Desktop\taha.wav');
time=(1/fs)*length(Y);
t=linspace(0,time,length(Y));
plot(t,Y)
load handel
sound(y,Fs);
time=(1/Fs)*length(y);
t=linspace(0,time,length(y));
plot(t,y)
load gong.mat;
sound(y);
figure: