Calculate convolution of two given continuous signals in matlab

조회 수: 212 (최근 30일)
Chihiro Ogino
Chihiro Ogino 2022년 5월 26일
댓글: Chihiro Ogino 2022년 6월 11일
If I have two continuous signals ,f1(t) = g10(t) and f2(t) = (e^-t)*u(t). How can I calculate the convolution and plot the graph for that? N:B: here g10 means the width of rectangular is 10(eg: -5 to 5)

채택된 답변

Paul
Paul 2022년 6월 5일
Closed form solution using symbolic math
syms t tau real
f1(t) = rectangularPulse(-5,5,t);
f2(t) = exp(-t)*heaviside(t);
y1(t) = int(f1(tau)*f2(t-tau),tau,-5,t)
y1(t) = 
figure;
fplot(y1(t),[-10 10])
hold on
Numerical solution using integral()
f1 = @(t) abs(t) <= 5;
f2 = @(t) exp(-t).*(t>=0);
y2 = @(t) integral(@(tau)(f1(tau).*f2(t-tau)),-5,t);
for tval = -7:2:10
plot(tval,y2(tval),'rx')
end
Numerical solution using conv(). Note that we have to settle for a vaue of t where we are willing to accept f2(t) = 0
dt = 0.1;
tval = -5:dt:15;
y3 = conv(f1(tval),f2(tval))*dt;
conv() assumes that the sequences start at t = 0, so we have to shift our time reference left by 5. Make dt smaller to improve the convolution sum approximation.
plot(tval-5,y3(1:numel(tval)),'ko')
legend('Closed Form','integral()','conv()','Location','NorthWest')

추가 답변 (1개)

Paul
Paul 2022년 5월 27일
Assuming a closed form solution is desired this problem can be solved with the Symbolic Math Toolbox
and also exp() (no doc page for Symbolic Math Toolbox version?)
  댓글 수: 2
Chihiro Ogino
Chihiro Ogino 2022년 5월 28일
But it shows that I've no Symbolic Toolbox. This is my very first tme using Matlab , and I'm totally lost how to overcome the issues
Paul
Paul 2022년 5월 28일
Then I guess you'll have to either do it by hand (or use other s/w that can do it symbolically), or you can use
to compute a numerical approximation of the convolution integral, or can use
to compute a numerical approximation to the convolution integral via the convolution sum.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by