convolution of exponential with unit step ... using conv command

86 visualizaciones (últimos 30 días)
Sadi Altamimi
Sadi Altamimi el 6 de Dic. de 2013
Editada: Walter Roberson el 31 de Dic. de 2020
Hi everybody,
Suppose we have two signals:
u(t) : unit step function and h(t) = exp(-t) * u(t)
Let us calculate their convolution. Doing that on paper is pretty easy, the result will be y(t) = (1-exp(-t)) * u(t). i.e the function will increase till it reaches the value of 1 and then it becomes constant = 1.
The big question is that why the following code produces wrong answer after time of 10s (this time is the length of the original signals)? In other words, why the result starts decaying after this time instant and reaches zero ?!
Code:
t = -1:0.01:10;
u = heaviside(t);
u(u==0.5) = 1;
subplot(221), plot(t,u), axis([-1 10 -.5 1.5])
h = exp(-t).* u;
subplot(222), plot(t,h), axis([-1 10 -.5 1.5])
C = conv(h,u)/100;
tc = [-200:length(C)-1-200]/100;
subplot(2,2,3:4), plot(tc,C), axis([-1 20 -.5 1.5])

Respuestas (3)

MUHAMMAD EZARISMA AFIF WISYU HARDI
MUHAMMAD EZARISMA AFIF WISYU HARDI el 31 de Dic. de 2020
Editada: Walter Roberson el 31 de Dic. de 2020
t = -1:0.01:10;
u = heaviside(t);
u(u==0.5) = 1;
subplot(221), plot(t,u), axis([-1 10 -.5 1.5])
h = exp(-t).* u;
subplot(222), plot(t,h), axis([-1 10 -.5 1.5])
C = conv(h,u)/100;
tc = [-200:length(C)-1-200]/100;
subplot(2,2,3:4), plot(tc,C), axis([-1 20 -.5 1.5])

David Goodmanson
David Goodmanson el 31 de Dic. de 2020
Editada: David Goodmanson el 31 de Dic. de 2020
Hi Muhammed,
since your reply is a copy of the the orignal code, nothing changes. Anyway, the reason for the effect is that when t stops at t = 10, the heaviside function effectively becomes the rectangle function U = heaviside(t).*heaviside(10-t). The convultion does exactly what it is supposed to with that, and gives the same result as you would get by doing the convolution of h with U.

Walter Roberson
Walter Roberson el 31 de Dic. de 2020
Editada: Walter Roberson el 31 de Dic. de 2020
t = -1:0.01:10;
u = heaviside(t);
u(u==0.5) = 1;
subplot(2,2,1); plot(t,u); axis([-1 10 -.5 1.5]);
h = exp(-t).* u;
subplot(2,2,2); plot(t,h); axis([-1 10 -.5 1.5]);
C = conv(h,u)/100;
tc = [-200:length(C)-1-200]/100;
subplot(2,2,3); plot(tc,C); axis([-1 20 -.5 1.5]);
Cv = conv(fliplr(h), u, 'same')/100;
subplot(2,2,4); plot(Cv)
Remember that convolution implicitly reverses one of the functions

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by