clc;
clear;
x=[9,8,7,6,5,4];
h=[1,2,3,4];
L= length(x);
M = length(h);
N = L+M-1;
X=[x,zeros(1,N-L)];
H=[h,zeros(1,N-M)];
for i=1:1:N
Y(i)=0;
for j=1:1:i
Y(i)= Y(i)+H(i-j+1).*X(j);
end
end
x;
h;
Y;
Y2=conv(x,h)
subplot(4,1,1);
stem(x);
xlabel('Elements in x');
ylabel('First graph');
subplot(4,1,2);
stem(h);
xlabel('Elements in h');
ylabel('Second graph');
subplot(4,1,3);
stem(Y);
xlabel('Elements in Y');
ylabel('Third graph');
subplot(4,1,4)
stem(Y2)
xlabel("elements in Y2")
ylabel("Fourth graph")