Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know much about Mathematica so I can only help you (partially) about the Matlab part.</p> <p>To do the convolution with the Matlab conv functions means you do it numerically. What you mean with the integral definition is that you want to do it symbolically. For this you need the Matlab Symbolic Toolbox. This is essentially a Maple plugin for Matlab. So what you want to know is how it works in Maple.</p> <p>You might find this link useful <a href="http://en.wikibooks.org/wiki/MATLAB_Programming/Symbolic_Toolbox#Differentiation_and_Integration_with_One_Variable" rel="nofollow">(wikibooks)</a> for an introduction on the MuPad in Matlab.</p> <p>I tried to implement your box function as a function in Matlab as</p> <pre><code>t = sym('t') f = (t &gt; -1) + (t &lt; 1) - 1 </code></pre> <p>However this does not work when t is ob symbolic type <code>Function 'gt' is not implemented for MuPAD symbolic objects</code>.</p> <p>You could declare <code>f</code> it as a piecewise function see <a href="http://www.mathworks.ch/help/toolbox/mupad/stdlib/piecewis.html#label1" rel="nofollow">(matlab online help)</a>, this did not work in my Matlab though. The examples are all Maple syntax, so they would work in Maple straight away.</p> <p>To circumvent this, I used</p> <pre><code>t = sym('t') s = sym('s') f = @(t) heaviside(t + 1) - heaviside(t - 1) </code></pre> <p>Unfortunately this is not successful</p> <pre><code>I = int(f(s)*f(t-s),s, 0, t) </code></pre> <p>gives</p> <pre><code>Warning: Explicit integral could not be found. </code></pre> <p>and does not provide an explicit result. You can still evaluate this expression, e.g.</p> <pre><code>&gt;&gt; subs(I, t, 1.5) ans = 1/2 </code></pre> <p>But Matlab/MuPad failed to give you and explicit expression in terms of t. This is not really unexpected as the function <code>f</code> is discontinuous. This is not so easy for symbolic computations.</p> <p>Now I would go and help the computer, fortunately for the example that you asked the answer is very easy. The convolution in your example is simply the <code>int_0^t BoxFunction(s) * BoxFunction(t - s) ds</code>. The integrant <code>BoxFunction(s) * BoxFunction(t - s)</code> is again a box function, just not one that goes from [-1,1] but to a smaller interval (that depends on t). Then you only need to integrate the function <code>f(x)=1</code> over this smaller interval. </p> <p>Some of those steps you would have to to by hand first, then you could try to re-enter them to Matlab. You don't even need a computer algebra program at all to get to the answer. </p> <p>Maybe Matematica or Maple could actually solve this problem, remember that the MuPad shipped with Matlab is only a stripped down version of Maple. Maybe the above might still help you, it should give you the idea how things work together. Try to put in a nicer function for f, e.g. a polynomial and you should get it working.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload