Convolution of two symfuns
조회 수: 34 (최근 30일)
이전 댓글 표시
Hello everyone,
I have an assignment which tells me to plot y(t), where y(t) is the convolution of x1(t) and x2(t). These are two symbolic functions declared this way:
x1 = symfun(29*t^2 - 165*t + 420, t)
x2 = symfun(symsum((-1)^k*dirac(t - 24*k), k, 0, 100) + symsum(1/(-1)^k*dirac(- t - 24*k), k, 1, 100), t)
I tried the following formula but it sends me an error:
y = symfun(conv(x1(t),x2(t), 'same'), t)
and the error is this one:
Undefined function 'conv2' for input arguments of type 'sym'.
Error in conv (line 40)
c = conv2(a(:),b(:),shape);
Can anyone help me?
댓글 수: 0
답변 (3개)
Walter Roberson
2018년 1월 10일
You need to use the convolution integral transform https://en.wikipedia.org/wiki/Convolution#Definition
conv() is only for discrete convolution, whereas you have a continuous system.
댓글 수: 0
Zane Cook
2022년 4월 18일
I know this post is old, but maybe this will help someone else that is trying to do this.
The easiest way I have found to do this is by using the fact that convolution in the time domain is multiplication in the frequency domain, and vice versa. You can take the fourier transform of your functions, multiply them, then take the inverse fourier and use fplot.
y=ifourier(fourier(x1)*fourier(x2))
fplot(y)
댓글 수: 0
Torsten
2018년 1월 10일
For comparison:
Result is
29*t^2-165*t+33408*(2*kend-1)+420
with kend = 100 in this case.
kend must be an even integer.
Best wishes
Torsten.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!