linear convolution of discrete time sequence

31 vues (au cours des 30 derniers jours)
Aniket Jadhav
Aniket Jadhav le 28 Nov 2022
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")

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur GPU Computing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by