convolution of exponential with unit step ... using conv command
57 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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])
0 Kommentare
Antworten (3)
MUHAMMAD EZARISMA AFIF WISYU HARDI
am 31 Dez. 2020
Bearbeitet: Walter Roberson
am 31 Dez. 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])
0 Kommentare
David Goodmanson
am 31 Dez. 2020
Bearbeitet: David Goodmanson
am 31 Dez. 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.
0 Kommentare
Walter Roberson
am 31 Dez. 2020
Bearbeitet: Walter Roberson
am 31 Dez. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!