EGR324L: Linear Systems and Signals Lab Lab 4: Convolution Sum Objective To learn how to compute convolution sum in Matlab. Background Convolution Sum in Matlab Let x[n] be a discrete-time signal such...

1 answer below »
I have this lab I need it to be done using Matlab. Please i need all the files that is mentioned in the instruction/questions.


EGR324L: Linear Systems and Signals Lab Lab 4: Convolution Sum Objective To learn how to compute convolution sum in Matlab. Background Convolution Sum in Matlab Let x[n] be a discrete-time signal such that x[n] = 0 for n < ox.="" then="" x[n]="" can="" be="" denoted="" by="" a="" pair="">, where vx = [ x[ox] x[ox+1 ] ... ] is an vector and x[ox] ≠ 0. In Fig. 1, x[n] =, where ox = -2 and vx = [ 1 -2]. And h[n] = , where oh = 3 and vh = [ -1 0 3 2]. Fig. l Representing general discrete time signals in Matlab It is easy to see that if x[ n] = , then x[n-n0] = . A built-in function vy = conv( vx, vh) is provided by Matlab to compute the convolution sum of two vectors vx and vh. With our notation, this function actually computes <0, vy=""> = <0, vx=""> *<0, vh="">. In order to use function conv to calculate convolution sum for general discrete-time signals, a signal x[n] = must be shifted to the left for ox steps (if ox > 0), Let x1[n] = <0, vx=""> = x[n+ox] = x[n] * δ[n+ox]. For h[n] = , we may have h1[n] = <0, vh=""> = h[n+oh] = h[n] * δ[n+oh]. By invoking Matlab function vy = conv( vx, vh), we actually obtain y 1 [n]= <0, vy=""> = x1[n] * h1[n] = (x[n] * δ[n+ox]) * (h[n] * δ[n+oh]) = (x[n] * h[n]) * δ[n+ox+oh] Thus 3 x[n] * h[n] = y1[n] * δ[n-(ox+oh)] = y1[n -(ox+oh)] = <0+ox+oh, vy=""> = Example: For signals x[n] and h[n] shown in Fig. 1, Matlab instructions for representing these two signals, and that for calculate the convolution sum of the two are given below. Fig. 2 Computing convolution sum of general discrete-time signals in Matlab Preparation You need to read the Matlab book for the following topics: · more functions and commands for graphical plotting · functions conv and deconv, rand and sound · for statement and if statement in Matlab · relational operators >, <,>= <= ,="=," ~="·" logic="" operators="" &,="" |="" and="" ~.="" problems="" (1)="" write="" a="" function="" [oy="" ,="" vy="" ]="gconv(ox" ,="" vx,="" oh,="" vh)="" that="" computes="" generalized="" convolution="" sum=""> = * , as defined in the background section of this handout. (2) Using the function gconv defined in (2), and function trainplot defined in Lab 3, calculate and plot y[n] = x[n] * h[n], where x[n] and h[n] are shown as in Fig. 4. Fig. 4 Compute convolution sum of two signals (3) Using Matlab functions vy = conv( vx, vh) and [vh, vr] = deconv( vy, vx), solve Problem 9.17 in the textbook. (4) A discrete-time system generating echoes of a sampled acoustic source is modeled as a causal and LTI system with unit impulse response where 0 < a="">< 1="" is="" called="" the="" attenuntion="" factor,="" n0="" represents="" the="" time="" delay="" of="" the="" echo,="" and="" m="" is="" the="" smallest="" integer="" such="" that="" ak="">< d, a pre-specified "dead band ratio". for instance, if a = 0.5, d = 0.01, write a function y = gecho( x, a, n0, d), where column vector y is obtained by convolving input vector x with the system impulse response h, which depends on attenuation factor a, time delay n0 and dead band ratio d defined as above. (5) test function gecho with the following parameters. plot the vector generated by function gecho. (6) apply function gecho to a signal hi.mat (sampled at 8,192 hz) using the following parameters. attenuation factor: 0.7 echo delay time: 1 second dead band ratio: 0.05 play the processed signal using matlab function sound(x). (7) repeat step (6) for the following four sets of parameteters: attenuation factor: 0.3attenuation factor: 0.7 echo delay time: 1 secondecho delay time: 2 second dead band ratio: 0.05dead band ratio: 0.05 attenuation factor: 0.7attenuation factor: 0.5 echo delay time: 1 secondecho delay time: 0.1 second dead band ratio: 0.2dead band ratio: 0.05 how do they compare with each other ? do they sound like what you predicted? you may wish to experiment this function with some other signals you sampled in the lab. report as usual, you should turn in all the matlab work. this includes all matlab programs (.m files) as well as all graphical plots. again, the audio signals should be plotted against time in seconds -- not in array indices. explain in detail how matlab was used to solve the problems. describe the experiment you did in (6) and (7). how do they compare with each other ? do they sound like what you predicted? (8) (9) you may wish to experiment this function with some other signals you sampled in the lab. (10) (11) report (12) (13) as usual, you should turn in all the matlab work. this includes all matlab programs (.m files) as well as all graphical plots. again, the audio signals should be plotted against time in seconds -- not in array indices. explain in detail how matlab was used to solve the problems. (14) (15) describe the experiment you did in (7) and (8). (16) report as usual, you should turn in all the matlab work. this includes all matlab programs (.m files) as well as all graphical plots. explain in detail how matlab was used to solve the problems. ( ( 5 ) ) d,="" a="" pre-specified="" "dead="" band="" ratio".="" for="" instance,="" if="" a="0.5," d="0.01," write="" a="" function="" y="gecho(" x,="" a,="" n0,="" d),="" where="" column="" vector="" y="" is="" obtained="" by="" convolving="" input="" vector="" x="" with="" the="" system="" impulse="" response="" h,="" which="" depends="" on="" attenuation="" factor="" a,="" time="" delay="" n0="" and="" dead="" band="" ratio="" d="" defined="" as="" above.="" (5)="" test="" function="" gecho="" with="" the="" following="" parameters.="" plot="" the="" vector="" generated="" by="" function="" gecho.="" (6)="" apply="" function="" gecho="" to="" a="" signal="" hi.mat="" (sampled="" at="" 8,192="" hz)="" using="" the="" following="" parameters.="" attenuation="" factor:="" 0.7="" echo="" delay="" time:="" 1="" second="" dead="" band="" ratio:="" 0.05="" play="" the="" processed="" signal="" using="" matlab="" function="" sound(x).="" (7)="" repeat="" step="" (6)="" for="" the="" following="" four="" sets="" of="" parameteters:="" attenuation="" factor:="" 0.3="" attenuation="" factor:="" 0.7="" echo="" delay="" time:="" 1="" second="" echo="" delay="" time:="" 2="" second="" dead="" band="" ratio:="" 0.05="" dead="" band="" ratio:="" 0.05="" attenuation="" factor:="" 0.7="" attenuation="" factor:="" 0.5="" echo="" delay="" time:="" 1="" second="" echo="" delay="" time:="" 0.1="" second="" dead="" band="" ratio:="" 0.2="" dead="" band="" ratio:="" 0.05="" how="" do="" they="" compare="" with="" each="" other="" do="" they="" sound="" like="" what="" you="" predicted?="" you="" may="" wish="" to="" experiment="" this="" function="" with="" some="" other="" signals="" you="" sampled="" in="" the="" lab.="" report="" as="" usual,="" you="" should="" turn="" in="" all="" the="" matlab="" work.="" this="" includes="" all="" matlab="" programs="" (.m="" files)="" as="" well="" as="" all="" graphical="" plots.="" again,="" the="" audio="" signals="" should="" be="" plotted="" against="" time="" in="" seconds="" --="" not="" in="" array="" indices.="" explain="" in="" detail="" how="" matlab="" was="" used="" to="" solve="" the="" problems.="" describe="" the="" experiment="" you="" did="" in="" (6)="" and="" (7).="" how="" do="" they="" compare="" with="" each="" other="" do="" they="" sound="" like="" what="" you="" predicted?="" (8)="" (9)="" you="" may="" wish="" to="" experiment="" this="" function="" with="" some="" other="" signals="" you="" sampled="" in="" the="" lab.="" (10)="" (11)="" report="" (12)="" (13)="" as="" usual,="" you="" should="" turn="" in="" all="" the="" matlab="" work.="" this="" includes="" all="" matlab="" programs="" (.m="" files)="" as="" well="" as="" all="" graphical="" plots.="" again,="" the="" audio="" signals="" should="" be="" plotted="" against="" time="" in="" seconds="" --="" not="" in="" array="" indices.="" explain="" in="" detail="" how="" matlab="" was="" used="" to="" solve="" the="" problems.="" (14)="" (15)="" describe="" the="" experiment="" you="" did="" in="" (7)="" and="" (8).="" (16)="" report="" as="" usual,="" you="" should="" turn="" in="" all="" the="" matlab="" work.="" this="" includes="" all="" matlab="" programs="" (.m="" files)="" as="" well="" as="" all="" graphical="" plots.="" explain="" in="" detail="" how="" matlab="" was="" used="" to="" solve="" the="" problems.="" (="" (="" 5="" )="">
Answered Same DayOct 05, 2021

Answer To: EGR324L: Linear Systems and Signals Lab Lab 4: Convolution Sum Objective To learn how to compute...

Kshitij answered on Oct 10 2021
133 Votes
nw gray/ans2.m
ox=-2
vx=[1 -2];
oh=3;
vh=[-1 0 3 2];
[oy,vy]=gconv(ox,vx,oh,vh)
nw gray/ans5.m
x=rand(10,1)
a=0.5;
N0=100;
d=0.0
1
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/ans6.m
x=rand(100,1)
sound(x)
a=0.7;
N0=100;
d=0.05
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/ans7.m
x=rand(100,1)
a=0.7;
N0=10;
d=0.05
[y] = gecho(x, a, N0, d)
plot(y)
xlabel('Time')
ylabel('amplitude')
nw gray/answer3.m
%a) if N=4
clc;
clear all;
close all;
n=0:5;%%creating time vector
N=4;%%taking N=4
x=(n>=0)-(n>=(N+1));%%generating x[n] sequence
h=(n>=0)-(n>=4);%%generating h[n] sequence
y=conv(x,h);%%convolution of x[n] and h[n]
disp(y);%%displaying y[n]
stem(y);%%plootting y[n]
xlabel('n--->');
ylabel('y[n]--->');
title('convoltion of x[n) and h[n]')
%%b)calculting the value of N<=5 for which y[3]=3 and y[6]=0
for N=0:5%%taking for loop for N from 0 to 5
x=(n>=0)-(n>=(N+1));%%calculting x[n] for each value of N
y1=conv(x,h);%% calculating new convolution sequence
if (y1(3+1)==3 & y1(6+1)==0)%%comparing x[3]=3 and y[6]=0
fprintf('the N values for y[3]=3 and y[6]=0 is %d \n ',N)
end
end
nw gray/gconv.m
function [oy,vy]=gconv(ox,vx,oh,vh)
nx=ox:1:length(vx)+ox; % Defining Axis for Vx vector
nh=oh:1:length(vh)+oh; % Defining Axis for Vh vector
vy=conv(vx,vh); %...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here