1 (edited by nap 2015-07-05 23:33:33)

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?

Cheers,
Nap

Post's attachments

Attachment icon Cross_Correlation_n_Convolution_Duration=1.png 14.86 kb, 147 downloads since 2015-07-05 

Attachment icon Cross_Correlation_n_Convolution_Duration=2.png 20.16 kb, 140 downloads since 2015-07-05 

2

Re: Strange graph results

Hm. The way you implemented the convolution and cross-correlation functions seems interesting. I saw the photographs you attached - they are fascinating. You are right in that the convolution and cross-correlation plots have incorrect amplitudes. And yes, there is an improper mirror. To answer your question, yes, there is something wrong with how you defined the function. To elaborate, you imputed a function that the program could not understand nor interpret properly to show a proper graph. Hope I could help,
Ed