In: Electrical Engineering
using matlab, compute and plot y [n] = x [n]* h [n],
where
a. x [n] = h [n] = a^n (0 <=n <=40) & a = 0.5
b. x [n] = cos [n]; h [n] = u [n]; n = 0:4:360
c. x [n] = sin [n] ; h [n] = a^n; n:4:360; a = 0.9
%answer a
%Type the following code in matlab m file than run it
clc
clear all
n=0:1:40;
a=0.5;
xn=a.^n;
hn=xn;
yn=conv(xn,hn);
stem(yn)
ylabel('amplitude');
xlabel('number of samples--->');
title('Y(N)=a^n*a^n');
%answer b
%Type the following code in matlab m file than run it
clear all;
close all;
clc;
N=360;
n=0:4:N-1;
xn=ones(1,N);
subplot(2,1,1)
stem(xn);
ylabel('amplitude');
xlabel('number of samples--->');
title('discrete unit step signal x(n)=u(n)');
subplot(2,1,2)
hn=cos(n);
stem(n,hn)
ylabel('amplitude');
xlabel('number of samples--->');
title('discrete signal h(n)= cos(n)');
yn=conv(xn,hn);
figure
stem(yn)
ylabel('amplitude');
xlabel('number of samples--->');
title('convolution of signal y(n)=u(n)*cos(n)');
%answer c
%Type the following code in matlab m file than run it
clc
clear all
n=4:1:360;
a=0.9;
hn=a.^n;
xn=sin(n);
yn=conv(xn,hn);
stem(yn)
ylabel('amplitude');
xlabel('number of samples--->');
title('Y(N)=sin(n)*a^n');