convolution of exponential with unit step ... using conv command
10 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (3 件)
MUHAMMAD EZARISMA AFIF WISYU HARDI
2020 年 12 月 31 日
編集済み: Walter Roberson
2020 年 12 月 31 日
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 件のコメント
David Goodmanson
2020 年 12 月 31 日
編集済み: David Goodmanson
2020 年 12 月 31 日
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 件のコメント
Walter Roberson
2020 年 12 月 31 日
編集済み: Walter Roberson
2020 年 12 月 31 日
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 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!