Convolution of two symfuns
Mostrar comentarios más antiguos
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?
Respuestas (3)
Walter Roberson
el 10 de En. de 2018
2 votos
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.
Zane Cook
el 18 de Abr. de 2022
2 votos
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)
Torsten
el 10 de En. de 2018
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.
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!