(a) Generate the following discrete functions using MATLAB. Plot the two functions on the same page using MATLAB stem function. For x2[k] plot the real and imaginary parts separately. Therefore, a total of three plots will be plotted on one page.
(i) x1[k]= -5.1sin((0.1*pi*k)-3*pi/4)+1.1cos(0.4*pi*k) such that k belongs in[-10,40]
(ii)x2[k]= ((-0.9)^k)*exp(i*pi*k/10) such that k belongs in[0,100]
(b) Are x1[k] and x2[k] periodic sequences. If so, what are their periods? Mark them on the plots.
(c) Calculate the total energy of x1[k] and x2[k] .
Matlab code:
clear all;
clc;
k = (-10:40)';
x1 = -5.1*sin((0.1.*pi.*k)-3.*pi/4)+1.1*cos(0.4.*pi.*k);
subplot(3,1,1);
stem(k,x1); %plotting signal x1
title('-5.1*sin((0.1.*pi.*k)-3.*pi/4)+1.1*cos(0.4.*pi.*k)');
xlabel ('N');
ylabel ('Amp');
%Energy computation for x1
px1 = sum(x1.^2);
disp('Energy of e1 is');
disp(px1);
subplot(3,1,2);
k = (0:100)';
x2 = ((-0.9).^k).*exp(1i.*pi.*k./10);
x2 = abs(x2);
stem(k,x2); %plotting signal x2
title('(-0.9).^k).*exp(1i.*pi.*k./10');
xlabel ('N');
ylabel ('Amp');
N = length(k);
disp('Energy of e2 is');
%Energy computation for x2
px2 = sum(x2.^2);
disp(px2);
Simulated plots:
Energy computed for the two signals.
For signal x1 is periodic with period N =20 and it has infinite energy.
For signal x2 is aperiodic and it has energy of 5.2632.
Get Answers For Free
Most questions answered within 1 hours.