Beruflich Dokumente
Kultur Dokumente
Thislabaimsattheunderstandingof:
MakingSignalsCausalandNonCausal
Convolution
PropertiesofConvolution
ImplementationofLowPassFIRFiltersanditsFrequencyResponse
ImplementationofHighPassFIRFiltersanditsFrequencyResponse
ImplementationandFrequencyResponseofaMovingAverageFilter
ImplementationofBandPassFilters
10.1
Causal Signal: A signal is said to be causal if it is zero for time<0. A signal can be made causal by
multiplyingitwithunitstep.
Example
clc
clearall
closeall
t=2:1/1000:2;
x1=sin(2*pi*2*t);
subplot(3,1,1);
plot(t,x1,'LineWidth',2);
xlabel('time');
ylabel('signalamplitude');
title('sin(2*\pi*f*t)');
u=(t>=0);
x2=x1.*u;
subplot(3,1,2);
plot(t,u,'r','LineWidth',2);
xlabel('time');
ylabel('SignalAmplitude');
title('UnitStep');
subplot(3,1,3);
plot(t,x2,'k','LineWidth',2);
xlabel('time');
ylabel('signalamplitude');
title('causalversionofsin(2*\pi*f*t)');
figure;
plot(t,x1,t,u,'.',t,x2,'LineWidth',2);
text(0,1.2,'u(t)','FontSize',16);
text(1.2,1.1,'x(t)','FontSize',16);
text(0.8,1.1,'x(t)*u(t)','FontSize',16);
axis([221.51.5]);
--------------------------TASK 01------------------------Sampletheabovesignaltogetitsdiscretetimecounterpart(take10samples/sec).Makethe
resultantsignalcausal.Displaythelollypopplotofeachsignal.
--------------------------TASK 02------------------------Asignalissaidtobeanticausalifitexistsforvaluesofn<0.Makethesignalgiveninabove
exampleanticausal.
--------------------------TASK 03------------------------Createafunctionbynameofsig_causalinmatlabthathastwoinputarguments:(i)adiscrete
timesignal,and(ii)apositionvector.Thefunctionshouldmakethegivensignalcausaland
returntheresultantsignaltothecallingprogram.
AnoncausalsignalisshownintheFigbelow.Writematlabcodetomakethesignalcausalby
callingtheabovementionedfunction.Plottheoriginalnoncausalsignalandtheresultant
causalsignal.
2 2
210123 4567
10.2 CONVOLUTION:
UsethematlabcommandConv(h,x)tofindconvolutionwhere
H=impulseresponse
X=inputsignal
Example
clc
clearall
closeall
h=[123454321];
x=sin(0.2*pi*[0:20]);
y=conv(h,x);
figure(1);
stem(x);
title('DiscreteFilterInputx[n]');
xlabel('index,n');
ylabel('Value,x[n]');
figure(2);
stem(y,'r');
title('DiscreteFilterOutputy[n]');
xlabel('index,n');
ylabel('Value,y[n]');
Eventhoughthereareonly21pointsinthexarray,theconvfunctionproduces8morepointsbecauseit
usestheconvolutionsummationandassumesthatx[n]=0whenn>20.
--------------------------TASK 04------------------------Convolvethefollowingsignals:
x=[24642];
h=[3121];
plottheinputsignalaswellastheoutputsignal.
--------------------------TASK 05------------------------Convolvethesignalx[n]=[123456]withanimpulsedelayedbytwosamples.Plottheoriginal
signalandtheresultofconvolution.
--------------------------TASK 06------------------------Convolutionisassociative.Giventhethreesignalx1[n],x2[n],andx3[n]as:
x1[n]=[311]
x2[n]=[421]
x3[n]=[32123]
Showthat(x1[n]*x2[n])*x3[n]=x1[n]*(x2[n]*x3[n])
--------------------------TASK 07------------------------Convolutioniscommutative.Givenx[n]andh[n]as:
X[n]=[1321]
H[n]=[112]
Showthatx[n]*h[n]=h[n]*x[n]
--------------------------TASK 08------------------------Determineh(n)forthesystem
10
y (n) = kx(n k )
k =0
Whenx(n)=2[n].Plottheinput,impulse,andtheoutput.
--------------------------TASK 09------------------------Giventheimpulseresponseofasystemas:
h[n]=2[n]+[n1]+2[n2]+4[n3]+3[n4]
Iftheinput x[n]=[n] +4[n1]+3[n2]+2[n3]isappliedtothesystem,determinethe
outputofthesystem.
--------------------------TASK 10------------------------Twosystemsareconnectedincascade.
y[n]
x[n]
h1[n]
h2[n]
h1[n]=[1321]
h2[n]=[112]
Iftheinputx[n]=[n]+4[n1]+3[n2]+2[n3]isapplied,determinetheoutput.
--------------------------TASK 11------------------------Giventhesignals:
x1[n]=2[n]3[n1]+3[n2]+4[n3]2[n4]
x2[n]=4[n]+2[n1]+3[n2][n3]2[n4]
x3[n]=3[n]+5[n1]3[n2]+4[n3]
Verifythat
x1[n]*(x2[n]*x3[n])=(x1[n]*x2[n])*x3[n]
x1[n]*x2[n]=x2[n]*x1[n]