linear convolution of discrete time sequence

2 次查看(过去 30 天)
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")

采纳的回答

Aniket Jadhav
Aniket Jadhav 2022-11-28
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")

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by