how to calculate convolution

7 vues (au cours des 30 derniers jours)
Zeeshan Ahmed
Zeeshan Ahmed le 27 Mar 2016
Commenté : Image Analyst le 17 Nov 2020
i need help,i want to calculate the convolution of two discrete time signal but an error has occurred
n=-20:20;
delta=(n>=3 & n<=8);
x=delta;
% x denotes x[n]
delta=(n>=4 & n<=15);
h=delta;
% h denotes h[n]
subplot(3,1,1)
stem(n,x,'filled');
xlabel('n');
ylabel('Amplitude');
title('X[n]');
subplot(3,1,2)
stem(n,h,'filled');
xlabel('n');
ylabel('Amplitude');
title('h[n]');
subplot(3,1,3)
c=conv(x,h);
stem(n,c,'filled');
xlabel('n');
ylabel('Amplitude');
title('y[n]');
help me find the error in the coding...
  3 commentaires
Zeeshan Ahmed
Zeeshan Ahmed le 27 Mar 2016
Attempt to execute SCRIPT conv as a function: C:\Users\Zeeshan\Documents\conv.m
Error in Untitled2 (line 19) c=conv(x,h);
above one
Zeeshan Ahmed
Zeeshan Ahmed le 27 Mar 2016
Attempt to execute SCRIPT conv as a function: C:\Users\Zeeshan\Documents\conv.m
Error in Untitled2 (line 19) c=conv(x,h);
above one

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 27 Mar 2016
conv() requires the inputs to be single or double, not logical.
  1 commentaire
Zeeshan Ahmed
Zeeshan Ahmed le 27 Mar 2016
means?

Connectez-vous pour commenter.

Plus de réponses (1)

Vishnu Teja
Vishnu Teja le 17 Nov 2020
Can any one solve this question Compute the convolution y[n] = x[n] * h[n] when 𝑥(𝑛) = 𝑎𝑛u(n),0 < a< 1, ℎ(𝑛) = 𝑏𝑛u(n), 0 < b< 1 Assume that a and b are not equal.
  1 commentaire
Image Analyst
Image Analyst le 17 Nov 2020
This is not an answer for Zeeshan. Please start your own question and explain why y=conv(x, h) does not work for you. And explain your definition of u.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Signal Processing Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by