Convolving two piecewise functions

26 views (last 30 days)
Osama Aliwat
Osama Aliwat on 27 Dec 2020
Commented: Walter Roberson on 27 Dec 2020
Is it possible to convolve using piecewise function like below ? I get error and don't know how to fix it
clc
clear
syms t
x=piecewise(-2<=t<1,2*(t+2).^2,1<=t<3,18,3<=t<5,-9*(t-5),0);
h=piecewise(0<=t<2,3*t,2<=t<4,-6*(t-3),0);
fplot(x)
hold on
fplot(h)
hold on
y(t)=conv(x,h,'same')
fplot(y)
grid

Answers (1)

Walter Roberson
Walter Roberson on 27 Dec 2020
No. conv() is only for discrete values. To do convolution with functions use int()
  2 Comments
Paul
Paul on 27 Dec 2020
Does conv work at all with sym objects?
Walter Roberson
Walter Roberson on 27 Dec 2020
Error using conv2 Invalid data type. First and second arguments must be numeric or logical.
Error in conv (line 43) c = conv2(a(:),b(:),shape);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!