1
$\begingroup$

I try to show the convolution of a step function and a triangle function is smooth with the following code:

Manipulate[f0 = UnitBox[p - t0]; f1 = 2 UnitTriangle[t0]; 
 f2 = Convolve[f0, f1, t0, t1];
 Plot[{f0, f1, f2} /. {t0 -> x, t1 -> x}, {x, -3, 3}], 
{{p, -2}, Locator}]

It should be something like this:

The original PIC

But after have a click to locate the Locator, it seems Mathematica have plot some "non-necessary" curves (I have marked by red cross):

After cilck

How the get the right plot?

$\endgroup$
2
$\begingroup$

I'm not really sure what you expect, because a Locator is clearly a point {x,y}. Even if you initialize it with -2, after the first click, it is converted to a point, thus the behavior.

Manipulate[f0 = UnitBox[First[p] - t0]; f1 = 2 UnitTriangle[t0];
 f2 = Convolve[f0, f1, t0, t1];
 Plot[{f0, f1, f2} /. {t0 -> x, t1 -> x}, {x, -3, 3}], {{p, {-2, 0}}, 
  Locator}]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ I see, it is exactly as you point out, it is a point!!! $\endgroup$ – van abel Oct 19 '13 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.