MATLAB: A program that computes and plots the convolution of the functions

convolution using matlab

Best Answer

  • Ok, at least you made some effort. I'll keep my answer at least somewhat similar to the code you started.
    function convl(x,h)
    % laplace transform each function,
    % compute the product, so convolve them
    con = laplace(x)*laplace(h);
    % inverse transform will be the convolution of x and h
    xh = ilaplace(con);
    % display the result as a function
    pretty(xh)
    % and plot
    ezplot(xh)
    No output arguments are necessary, unless you wanted to return xh.
    syms t
    f1 = sin(t);
    f2 = cos(t);
    convl(f1,f2)
    The output is:
    t sin(t)
    --------
    2
    %