How to take the convolution of two functions

I'm trying to find the convolution of a x=rectangular pulse function and an f=inverse laplace transform function(found by doing ilaplace) however when I type the code y=conv(x,f) it throws these errors:
Error using conv2
Invalid data type. First and second arguments must be numeric or logical.
Error in conv (line #)
c = conv2(a(:),b(:),shape);
I've looked up many examples to try to fix this but so far none have worked.Any advice would be appreciated.

2 Comments

What are the data types of a and b?
The pulse wave is a matrix and the ilaplace is a function of t. I've tried evaluating it by f=f|t but it does not seem to help.

Sign in to comment.

Answers (1)

For convolutions of functions, you have a few options:
  1. Do not take the convolution of functions, take the convolution of vectors of values. This can be done in multiple ways, including by using filter() and methods involving fft(). This is discrete convolution and does not give you a formula for the result
  2. If you need formulas for the result, then use the symbolic toolbox to calculate the convolution integral
  3. If you need formulas for the result, in the special case of functions are 0 for negative values, then you can take the inverse laplace transform of the product of the laplace transforms of the two functions. http://mathfaculty.fullerton.edu/mathews/c2003/laplaceconvolutionmod.html

Categories

Find more on Computational Geometry in Help Center and File Exchange

Asked:

JL
on 24 Nov 2017

Answered:

on 24 Nov 2017

Community Treasure Hunt

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

Start Hunting!