Topic: Strange graph results
I'm learining Graph by implementing the Convolution and Cross-Correlation functions, as per Wikipedia.
I've used custom functions for this as follows:
Duration = 1 a(x) = if( x < 0, 0, x < Duration, 1, x > Duration, 0) # _-_ function b(x) = if( x < 0, 0, x < Duration, 1 - ( x / Duration), 0) # _\_ function Convolution(t) = integrate( a(dT) * b( t - dT ), dT ,-INF,INF) crossCorrelation(t) = integrate( conj( a ( dT ) ) * b( dT + t ), dT,-INF,INF) autoCorrelationA(t) = integrate( conj( a ( dT ) ) * a( dT + t ), dT,-INF,INF) autoCorrelationB(t) = integrate( conj( b ( dT ) ) * b( dT + t ), dT,-INF,INF)
The resulting graphs look a bit strange. Compare the images attached; When duration is one, compared to when it's two. There are missing portions of the plots, and some results are truncated (eg @ approx -1.55 and 3.55 the curves suddenly return 0 values.
A follow-on question concerning the actual calculation:
Whilst the Convolution and Autocorrelation plots have the right shape, it seems their amplitudes are not correct.
The Cross-Correlation plot is calculated as the mirror (wrt Y axis) of what it should be.
Is there something wrong with how I've defined the functions?
Can someone help me understand what's going on?