DSPRelated.com
Forums

Convolve exponential with rect

Started by Peter Mairhofer August 18, 2014
Hi,

I have a pretty trivial issue: I want to convolve a shifted rect
function with an exponential:

h(t) = 2pi/K e^(-2pi/K t)
p(t) = rect(t-1/2)

g(t) = (h*p)(t)

When I do the convolution with a discrete-time approximation numerically
in MATLAB (either conv or cconv) I get the blue line:

http://snag.gy/ZOhp5.jpg

When do the convolution analytically, I get

g(t) = e^(-2pi/K (t-1)) - e^(-2pi/K t)

which is the green line in the plot. Of course, discrete and continuous
convolutions are different but I would still expect a rough "match" when
I do fine time steps (in my case delta t = 1/1000).
I tried to add much zero padding, increase the time resolution etc. but
the result stays the same.

I "trust" the continuous result more but this shows the same result as
the discrete result:

http://lpsa.swarthmore.edu/Convolution/Convolution3.html#A_Rectangular_Pulse_and_an_Exponential

Did I do a trivial mistake when executing for continuous convolution?
Where does the difference come from?


Thanks
Peter

PS: This is a simple example, I observe the same thing for example for
higher order systems
On Monday, August 18, 2014 4:29:00 PM UTC-4, Peter Mairhofer wrote:
> Hi, > > > > I have a pretty trivial issue: I want to convolve a shifted rect > > function with an exponential: > > > > h(t) = 2pi/K e^(-2pi/K t) > > p(t) = rect(t-1/2) > > > > g(t) = (h*p)(t) > > > > When I do the convolution with a discrete-time approximation numerically > > in MATLAB (either conv or cconv) I get the blue line: > > > > http://snag.gy/ZOhp5.jpg > > > > When do the convolution analytically, I get > > > > g(t) = e^(-2pi/K (t-1)) - e^(-2pi/K t) > > > > which is the green line in the plot. Of course, discrete and continuous > > convolutions are different but I would still expect a rough "match" when > > I do fine time steps (in my case delta t = 1/1000). > > I tried to add much zero padding, increase the time resolution etc. but > > the result stays the same. > > > > I "trust" the continuous result more but this shows the same result as > > the discrete result: > > > > http://lpsa.swarthmore.edu/Convolution/Convolution3.html#A_Rectangular_Pulse_and_an_Exponential > > > > Did I do a trivial mistake when executing for continuous convolution? > > Where does the difference come from? > > > > > > Thanks > > Peter > > > > PS: This is a simple example, I observe the same thing for example for > > higher order systems
Clearly your continuous convolution is incorrect. Think about what you expect the correct continuous plot to be like near time 0; it isn't making a jump like that. What values of time is your g(t) supposed to be valid for? I would expect an equation for time up to 0; another for time (0,1]; and another for time >1. If you scan and post your continuous convolution calculations, I think your mistake will be easily found. Dirk
On 2014-08-18 15:12, bellda2005@gmail.com wrote:
> [...] > Clearly your continuous convolution is incorrect. [...] > I would expect an equation for time up to > 0; another for time (0,1]; and another for time >1.
Thanks. I know I missed something trivial: H(t) Peter