Convolution of two symfuns
Mostra commenti meno recenti
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?
Risposte (3)
Walter Roberson
il 10 Gen 2018
2 voti
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
il 18 Apr 2022
2 voti
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
il 10 Gen 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.
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!