ECE 220: Continuous-Time Signals and Systems Spring 2020 Lab 2 Due Date Refer to the ECE 220 Laboratory Schedule for your section to determine the report due date. Submit via Black- board. Description...

1 answer below »
Hello,I need help with my matlab assignment. I will attach a copy of the assignment. I also have an online access to matlab, and if you need it, then let me know, and i'll provide my password.if you have any question, let me know, thank you.



ECE 220: Continuous-Time Signals and Systems Spring 2020 Lab 2 Due Date Refer to the ECE 220 Laboratory Schedule for your section to determine the report due date. Submit via Black- board. Description The purpose of this project is to learn how to use Matlab to implement the convolution integral numerically. You will gain more practice with convolution, and see an application of convolution in implementing an acoustic model of a room or other performance space. 1 Prelab Before starting on the lab exercises below, review section 2.2.1 in the Signals and Systems text by Oppen- heim/Willsky/Nawab. Also prior to beginning the lab, determine and sketch the convolution y(t) = x(t) ∗ h(t) when h(t) and x(t) are as defined below: h(t) = u(t) x(t) = e−tu(t). 2 Numerical Approximation to Convolution The continuous-time convolution integral is defined as follows: y(t) = ∫ +∞ −∞ x(τ)h(t− τ)dτ. (1) In order to use Matlab to implement the convolution integral, it is helpful to model the signals x(t) and h(t) as piecewise-constant functions. Following section 2.2.1 of the Oppenheim/Willsky/Nawab textbook, the signal x(t) can be approximated by x̂(t): x̂(t) = +∞∑ k=−∞ x(k∆)δ∆(t− k∆), (2) where the short rectangular pulse δ∆(t) is defined as follows δ∆(t) = { 1 −∆/2 ≤ t < ∆/2 0 otherwise (3) note that the definition of δ∆(t) in equation 3 differs slightly from that of the textbook, but the basic idea is the same. the signal h(t) can be approximated in a similar manner, i.e., ĥ(t) = +∞∑ k=−∞ h(k∆)δ∆(t− k∆), (4) in other words, x(t) and h(t) are approximated as a series of narrow rectangular pulses with heights determined by the values of the functions sampled at the center of each rectangular pulse. figure 1 shows x̂(t) and ĥ(t) 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 t x (t ) 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 t h (t ) figure 1: piecewise-constant approximations to the signals x(t) and h(t). these approximations were com- puted with ∆ = 0.25. computed using ∆ = 0.25, thus there is a short pulse located every 0.25 seconds. obviously the approximations will improve as ∆ is reduced. the goal of this section is to compute the convolution of these piecewise-constant signals, i.e., to compute ŷ(t) defined as ŷ(t) = ∫ +∞ −∞ x̂(τ)ĥ(t− τ)dτ. (5) matlab can’t compute a continuous function, but it can compute samples of a function. fortunately, if we choose to compute the samples of ŷ(t) located ∆ seconds apart, the calculations will be simplified substantially. in other words, we’ll focus on computing the samples ŷ(n∆) for n = 0, 1, 2, . . . consider the equation for ŷ(1∆): ŷ(1∆) = ∫ +∞ −∞ x̂(τ)ĥ(1 − τ)dτ. (6) to compute this integral, we need ĥ(1 − τ), which is shown in figure 2. from figures 1 and 2 we can see that the piecewise-constant sections of x̂(τ) and ĥ(1− τ) are perfectly aligned. multiplication of x̂(τ) and ĥ(1− τ) yields another piecewise-constant function, and computing the integral is very easy to do. (remember that an integral corresponds to the area under a function, and it is easy to compute areas of rectangles.) whenever t is equal to a multiple of ∆ (i.e., t = n∆) the functions will be aligned and the integral will be easy to compute. 1. starting from the convolution sum, show how that the desired samples of ŷ(t) can be computed as follows ŷ(n∆) = ∆ +∞∑ k=−∞ x(k∆)h((n− k)∆). (7) note that this equation should be familiar from your work in ece 201. it is the discrete convolution sum! matlab provides a function called conv that computes discrete convolution sums. type help conv to read more about this function. 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 τ h (1 − τ ) figure 2: piecewise-constant approximation to the signal h(1−τ). the approximation was computed assuming ∆ = 0.25. 2. define the vector x1 to be samples of the signal x(t) defined in the prelab for 0 ≤ t ≤ 10. similarly define the vector h1 to be samples of the signal h(t) for 0 ≤ t ≤ 10. (remember that matlab indexes its vectors starting at 1, so the n = 0 sample will be x1(1)). use the conv function to compute y1 defined by the convolution given in equation 7. note that because x1 and h1 are finite-length segments of infinite length signals, only a finite-length segment of y1 will be valid. for what values of t does y1 represent a good approximation to the y(t) you found in the prelab? 3. re-do the calculations in part b for several values of ∆: ∆ = 0.25, 0.1, and 0.01. plot your results on a single graph, along with the exact results you found in the prelab. comment on how well the approximations work for different values of ∆. 4. for x(t) = t(u(t)− u(t− 8)) and h(t) = u(t)− u(t− 12), determine the convolution analytically. find the convolution by representing the signals as piece-wise continuous functions as above. does it match with your analytical prediction? what value of ∆ did you choose? 3 using convolution to model an acoustic system in this part of the lab you will use convolution to simulate what you would hear when someone speaks or sings in particular room (or other acoustic environment). what you hear includes the sound produced by the person and the sum of all the reflections of that sound off the walls and other objects in the room. reverberation is the term used to describe the sum of the reflected sound. in this lab you will model the reverberation effects of a room as a linear time-invariant system (lti) that is characterized by its impulse response. you will use convolution to implement the lti system and compute the output for a given acoustical input signal. in audio engineering, this type of simulation is often referrred to as auralization. 1. visit the website to read more about auralization and to download impulse responses for two different environments that you would like to simulate. make plots of those impulse responses in matlab and comment on their features. based on the impulse response, say what you expect to hear if you sang/spoke in that environment. note that your plots should correctly show the time axis for the impulse response signals. pay careful attention to the sampling frequency that was used to obtain the data. 2. download the recording of the anechoic voice from the website. load it into matlab and plot and play the signal. you will use this voice in some of your simulations. http://openairlib.net http://openairlib.net 3. write a function to compute the output of your room simulation given an input signal and the impulse response signal. include a copy of your function in the report, along with a description of how you verified that it was working. 4. test your function with the anechoic voice sample and the impulse responses for the two rooms. play the outputs in matlab and plot the output signals. describe what you hear. does the output sound like you expected it to? 5. in this final part of the project you will record the impulse response for a room/environment of your choice. first brainstorm about how to create an impulse so that you can record it using the same software you used in lab 1. describe your approach to measuring the impulse response in the report. 6. record the impulse response for the environment you selected. include plots of the measured impulse response along with a description of the room and your test setup. please include a picture of the room in your report. 7. make a short recording of your own voice to use in simulations. you should use the recording software you used last time. include a plot of your voice in the report. 8. run your voice through the room simulator function using your measured input. does the output sound like what you expected? why or why not? 4 acknowledgment the first part of this assignment was motivated by a similar project in the book computer explorations in signals and systems using matlab by john r. buck, michael m. daniel, and andrew c. singer. ece 220 lab 2 check-off sheet name: lab section: show the ta that your analytical predictions for the two convolution problems match the results you got numerically. run the anechoic voice and your own voice sample through the room simulator function (using im- pulse response downloaded from the website and the impulse response of a room recorded by you). play the outputs to your ta. what did you use as your impulse function to record the impulse response of the room? ta signature and date: ta comments: prelab numerical approximation to convolution using convolution to model an acoustic system acknowledgment ∆/2="" 0="" otherwise="" (3)="" note="" that="" the="" definition="" of="" δ∆(t)="" in="" equation="" 3="" differs="" slightly="" from="" that="" of="" the="" textbook,="" but="" the="" basic="" idea="" is="" the="" same.="" the="" signal="" h(t)="" can="" be="" approximated="" in="" a="" similar="" manner,="" i.e.,="" ĥ(t)="+∞∑" k="−∞" h(k∆)δ∆(t−="" k∆),="" (4)="" in="" other="" words,="" x(t)="" and="" h(t)="" are="" approximated="" as="" a="" series="" of="" narrow="" rectangular="" pulses="" with="" heights="" determined="" by="" the="" values="" of="" the="" functions="" sampled="" at="" the="" center="" of="" each="" rectangular="" pulse.="" figure="" 1="" shows="" x̂(t)="" and="" ĥ(t)="" 0="" 0.5="" 1="" 1.5="" 2="" 2.5="" 3="" 3.5="" 4="" 4.5="" 5="" 0="" 0.5="" 1="" 1.5="" 2="" t="" x="" (t="" )="" 0="" 0.5="" 1="" 1.5="" 2="" 2.5="" 3="" 3.5="" 4="" 4.5="" 5="" 0="" 0.5="" 1="" 1.5="" 2="" t="" h="" (t="" )="" figure="" 1:="" piecewise-constant="" approximations="" to="" the="" signals="" x(t)="" and="" h(t).="" these="" approximations="" were="" com-="" puted="" with="" ∆="0.25." computed="" using="" ∆="0.25," thus="" there="" is="" a="" short="" pulse="" located="" every="" 0.25="" seconds.="" obviously="" the="" approximations="" will="" improve="" as="" ∆="" is="" reduced.="" the="" goal="" of="" this="" section="" is="" to="" compute="" the="" convolution="" of="" these="" piecewise-constant="" signals,="" i.e.,="" to="" compute="" ŷ(t)="" defined="" as="" ŷ(t)="∫" +∞="" −∞="" x̂(τ)ĥ(t−="" τ)dτ.="" (5)="" matlab="" can’t="" compute="" a="" continuous="" function,="" but="" it="" can="" compute="" samples="" of="" a="" function.="" fortunately,="" if="" we="" choose="" to="" compute="" the="" samples="" of="" ŷ(t)="" located="" ∆="" seconds="" apart,="" the="" calculations="" will="" be="" simplified="" substantially.="" in="" other="" words,="" we’ll="" focus="" on="" computing="" the="" samples="" ŷ(n∆)="" for="" n="0," 1,="" 2,="" .="" .="" .="" consider="" the="" equation="" for="" ŷ(1∆):="" ŷ(1∆)="∫" +∞="" −∞="" x̂(τ)ĥ(1="" −="" τ)dτ.="" (6)="" to="" compute="" this="" integral,="" we="" need="" ĥ(1="" −="" τ),="" which="" is="" shown="" in="" figure="" 2.="" from="" figures="" 1="" and="" 2="" we="" can="" see="" that="" the="" piecewise-constant="" sections="" of="" x̂(τ)="" and="" ĥ(1−="" τ)="" are="" perfectly="" aligned.="" multiplication="" of="" x̂(τ)="" and="" ĥ(1−="" τ)="" yields="" another="" piecewise-constant="" function,="" and="" computing="" the="" integral="" is="" very="" easy="" to="" do.="" (remember="" that="" an="" integral="" corresponds="" to="" the="" area="" under="" a="" function,="" and="" it="" is="" easy="" to="" compute="" areas="" of="" rectangles.)="" whenever="" t="" is="" equal="" to="" a="" multiple="" of="" ∆="" (i.e.,="" t="n∆)" the="" functions="" will="" be="" aligned="" and="" the="" integral="" will="" be="" easy="" to="" compute.="" 1.="" starting="" from="" the="" convolution="" sum,="" show="" how="" that="" the="" desired="" samples="" of="" ŷ(t)="" can="" be="" computed="" as="" follows="" ŷ(n∆)="∆" +∞∑="" k="−∞" x(k∆)h((n−="" k)∆).="" (7)="" note="" that="" this="" equation="" should="" be="" familiar="" from="" your="" work="" in="" ece="" 201.="" it="" is="" the="" discrete="" convolution="" sum!="" matlab="" provides="" a="" function="" called="" conv="" that="" computes="" discrete="" convolution="" sums.="" type="" help="" conv="" to="" read="" more="" about="" this="" function.="" 0="" 0.5="" 1="" 1.5="" 2="" 2.5="" 3="" 3.5="" 4="" 4.5="" 5="" 0="" 0.5="" 1="" 1.5="" 2="" τ="" h="" (1="" −="" τ="" )="" figure="" 2:="" piecewise-constant="" approximation="" to="" the="" signal="" h(1−τ).="" the="" approximation="" was="" computed="" assuming="" ∆="0.25." 2.="" define="" the="" vector="" x1="" to="" be="" samples="" of="" the="" signal="" x(t)="" defined="" in="" the="" prelab="" for="" 0="" ≤="" t="" ≤="" 10.="" similarly="" define="" the="" vector="" h1="" to="" be="" samples="" of="" the="" signal="" h(t)="" for="" 0="" ≤="" t="" ≤="" 10.="" (remember="" that="" matlab="" indexes="" its="" vectors="" starting="" at="" 1,="" so="" the="" n="0" sample="" will="" be="" x1(1)).="" use="" the="" conv="" function="" to="" compute="" y1="" defined="" by="" the="" convolution="" given="" in="" equation="" 7.="" note="" that="" because="" x1="" and="" h1="" are="" finite-length="" segments="" of="" infinite="" length="" signals,="" only="" a="" finite-length="" segment="" of="" y1="" will="" be="" valid.="" for="" what="" values="" of="" t="" does="" y1="" represent="" a="" good="" approximation="" to="" the="" y(t)="" you="" found="" in="" the="" prelab?="" 3.="" re-do="" the="" calculations="" in="" part="" b="" for="" several="" values="" of="" ∆:="" ∆="0.25," 0.1,="" and="" 0.01.="" plot="" your="" results="" on="" a="" single="" graph,="" along="" with="" the="" exact="" results="" you="" found="" in="" the="" prelab.="" comment="" on="" how="" well="" the="" approximations="" work="" for="" different="" values="" of="" ∆.="" 4.="" for="" x(t)="t(u(t)−" u(t−="" 8))="" and="" h(t)="u(t)−" u(t−="" 12),="" determine="" the="" convolution="" analytically.="" find="" the="" convolution="" by="" representing="" the="" signals="" as="" piece-wise="" continuous="" functions="" as="" above.="" does="" it="" match="" with="" your="" analytical="" prediction?="" what="" value="" of="" ∆="" did="" you="" choose?="" 3="" using="" convolution="" to="" model="" an="" acoustic="" system="" in="" this="" part="" of="" the="" lab="" you="" will="" use="" convolution="" to="" simulate="" what="" you="" would="" hear="" when="" someone="" speaks="" or="" sings="" in="" particular="" room="" (or="" other="" acoustic="" environment).="" what="" you="" hear="" includes="" the="" sound="" produced="" by="" the="" person="" and="" the="" sum="" of="" all="" the="" reflections="" of="" that="" sound="" off="" the="" walls="" and="" other="" objects="" in="" the="" room.="" reverberation="" is="" the="" term="" used="" to="" describe="" the="" sum="" of="" the="" reflected="" sound.="" in="" this="" lab="" you="" will="" model="" the="" reverberation="" effects="" of="" a="" room="" as="" a="" linear="" time-invariant="" system="" (lti)="" that="" is="" characterized="" by="" its="" impulse="" response.="" you="" will="" use="" convolution="" to="" implement="" the="" lti="" system="" and="" compute="" the="" output="" for="" a="" given="" acoustical="" input="" signal.="" in="" audio="" engineering,="" this="" type="" of="" simulation="" is="" often="" referrred="" to="" as="" auralization.="" 1.="" visit="" the="" website="" to="" read="" more="" about="" auralization="" and="" to="" download="" impulse="" responses="" for="" two="" different="" environments="" that="" you="" would="" like="" to="" simulate.="" make="" plots="" of="" those="" impulse="" responses="" in="" matlab="" and="" comment="" on="" their="" features.="" based="" on="" the="" impulse="" response,="" say="" what="" you="" expect="" to="" hear="" if="" you="" sang/spoke="" in="" that="" environment.="" note="" that="" your="" plots="" should="" correctly="" show="" the="" time="" axis="" for="" the="" impulse="" response="" signals.="" pay="" careful="" attention="" to="" the="" sampling="" frequency="" that="" was="" used="" to="" obtain="" the="" data.="" 2.="" download="" the="" recording="" of="" the="" anechoic="" voice="" from="" the="" website.="" load="" it="" into="" matlab="" and="" plot="" and="" play="" the="" signal.="" you="" will="" use="" this="" voice="" in="" some="" of="" your="" simulations.="" http://openairlib.net="" http://openairlib.net="" 3.="" write="" a="" function="" to="" compute="" the="" output="" of="" your="" room="" simulation="" given="" an="" input="" signal="" and="" the="" impulse="" response="" signal.="" include="" a="" copy="" of="" your="" function="" in="" the="" report,="" along="" with="" a="" description="" of="" how="" you="" verified="" that="" it="" was="" working.="" 4.="" test="" your="" function="" with="" the="" anechoic="" voice="" sample="" and="" the="" impulse="" responses="" for="" the="" two="" rooms.="" play="" the="" outputs="" in="" matlab="" and="" plot="" the="" output="" signals.="" describe="" what="" you="" hear.="" does="" the="" output="" sound="" like="" you="" expected="" it="" to?="" 5.="" in="" this="" final="" part="" of="" the="" project="" you="" will="" record="" the="" impulse="" response="" for="" a="" room/environment="" of="" your="" choice.="" first="" brainstorm="" about="" how="" to="" create="" an="" impulse="" so="" that="" you="" can="" record="" it="" using="" the="" same="" software="" you="" used="" in="" lab="" 1.="" describe="" your="" approach="" to="" measuring="" the="" impulse="" response="" in="" the="" report.="" 6.="" record="" the="" impulse="" response="" for="" the="" environment="" you="" selected.="" include="" plots="" of="" the="" measured="" impulse="" response="" along="" with="" a="" description="" of="" the="" room="" and="" your="" test="" setup.="" please="" include="" a="" picture="" of="" the="" room="" in="" your="" report.="" 7.="" make="" a="" short="" recording="" of="" your="" own="" voice="" to="" use="" in="" simulations.="" you="" should="" use="" the="" recording="" software="" you="" used="" last="" time.="" include="" a="" plot="" of="" your="" voice="" in="" the="" report.="" 8.="" run="" your="" voice="" through="" the="" room="" simulator="" function="" using="" your="" measured="" input.="" does="" the="" output="" sound="" like="" what="" you="" expected?="" why="" or="" why="" not?="" 4="" acknowledgment="" the="" first="" part="" of="" this="" assignment="" was="" motivated="" by="" a="" similar="" project="" in="" the="" book="" computer="" explorations="" in="" signals="" and="" systems="" using="" matlab="" by="" john="" r.="" buck,="" michael="" m.="" daniel,="" and="" andrew="" c.="" singer.="" ece="" 220="" lab="" 2="" check-off="" sheet="" name:="" lab="" section:="" show="" the="" ta="" that="" your="" analytical="" predictions="" for="" the="" two="" convolution="" problems="" match="" the="" results="" you="" got="" numerically.="" run="" the="" anechoic="" voice="" and="" your="" own="" voice="" sample="" through="" the="" room="" simulator="" function="" (using="" im-="" pulse="" response="" downloaded="" from="" the="" website="" and="" the="" impulse="" response="" of="" a="" room="" recorded="" by="" you).="" play="" the="" outputs="" to="" your="" ta.="" what="" did="" you="" use="" as="" your="" impulse="" function="" to="" record="" the="" impulse="" response="" of="" the="" room?="" ta="" signature="" and="" date:="" ta="" comments:="" prelab="" numerical="" approximation="" to="" convolution="" using="" convolution="" to="" model="" an="" acoustic="" system="">
Answered Same DayFeb 06, 2021

Answer To: ECE 220: Continuous-Time Signals and Systems Spring 2020 Lab 2 Due Date Refer to the ECE 220...

Kshitij answered on Feb 12 2021
134 Votes
filestoup/alcuin_s1r1_w_channel.wav
filestoup/bagpipe_steady_chord.wav
filestoup/convolv_Data.m
function y=convo
lv_Data(xData,yData)
% Convolution of discrete signals
% function to compute the output of your
% room simulation given an input signal and
% the impulse response signal.
na=length(xData); % Get the length of the vector imp
nb=length(yData); % Get the length of the vecotr yData
%Y=zeros(na,nb+na+1); % The result of multiplication will be stored in the vector Y
l=0;y=0;
for ii=1:na
for kk=1:nb
Y(ii,kk+l)=xData(ii)*yData(kk); % Perform the multiplication element by elements
end
l=l+1;
end
for ll=1:na
y=y+Y(ll,:); % Perform the convolutions
end
filestoup/OutSignal.m
clear all; clc;
% Test your function with the anechoic voice sample and the impulse responses for the two rooms. Play
% the outputs in MATLAB and plot the output signals
[yimp,Fsim]=audioread('alcuin_s1r1_w_channel.wav');
[yData,Fs]=audioread('bagpipe_steady_chord.wav');
dt = 1/Fsim;
%%
yim=yimp(:,1);
yD= yData(:,1);
t1 =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here