[Kst] Convolve plugin results

David McMinn David.McMinn at halliburton.com
Mon May 18 12:59:01 UTC 2015


Hi,

I'm trying to use the convolve plugin to filter some data using filter coefficients that were generated by another piece of software. I am not getting the results I expected and I cannot find anything online about issues or misunderstandings with the convolve plugin so I thought I'd ask here as I assume I am misunderstanding something. This is using Kst2.0.8 32 bit on Windows, the last official release. I have simplified and attached the test data here and used a moving average for ease of understanding.

I have two vectors loaded from an ASCII file (one with data points, one with filter coefficients for a 10 point moving average filter, so all filter values are 0.1).
In KST I loaded them and used the "Convolve" standard plugin and used the filter coefficients for Input Vector One and the data points for Input Vector Two.

The output I get in KST is different from what I thought I would get. Calculating a moving average in Excel on the data produces the same values at the start of the output as performing a convolution in Matlab. In Excel I simply have an extra column with "=SUM(A<row-10>:A<row>)/10". In Matlab I have loaded the data and checked the output of "conv(data, filter)".

Duplicating what KST does internally (padding, moving the response values to be in wrap order, FFT, multiply, IFFT) in Matlab gives me the same result as Excel and Matlab's conv() function. The Matlab code I used was:

    data = importdata('data.txt');
    filter = importdata('filter.txt');
    f1=fft(data,64);
    f2=fft(filter,64);
    fo=f1.*f2;
    ifft(fo)

ans =

   0.004113010000000
   0.008497620000000
   0.012553410000000
   0.016814430000000
   0.021379860000000
   0.025922400000000
   0.030484010000000
   0.034965520000000
   0.039740760000000
   0.044651040000000
   0.045243840000000
   0.045298770000000
   0.045538330000000
   0.045906830000000
   0.045743560000000
[snip]


The output from KST vs the others is as follows:

KST            Matlab/Excel
0.0244159      0.00411301
0.0319899      0.00849762
0.0334602      0.01255341
0.0412454      0.01681443
0.0431469      0.02137986
0.0508604      0.02592240
0.0481804      0.03048401
0.0510966      0.03496552
0.0486658      0.03974076
0.0518106      0.04465104
0.0481752      0.04524384
0.0509959      0.04529877
0.0481186      0.04553833
0.0510038      0.04590683
0.0477588      0.04574356

Obviously there is some offset of about half the filter length in the values and that I need to start comparing between the 0th element in KST and the 5th element in the other software. I don't think this is a numerical rounding error as the differences are significant when compared to the values. The KST mean level is noticeably higher than when calculated using other methods.

So my question is: is this a misunderstanding on my part (either in what I expect or how I'm checking) or an error in KST?

Thanks.

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: data.txt
URL: <http://mail.kde.org/pipermail/kst/attachments/20150518/fd943cae/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filter.txt
URL: <http://mail.kde.org/pipermail/kst/attachments/20150518/fd943cae/attachment-0003.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.kst
Type: application/octet-stream
Size: 8906 bytes
Desc: test.kst
URL: <http://mail.kde.org/pipermail/kst/attachments/20150518/fd943cae/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: average.xls
Type: application/vnd.ms-excel
Size: 25088 bytes
Desc: average.xls
URL: <http://mail.kde.org/pipermail/kst/attachments/20150518/fd943cae/attachment-0001.xls>


More information about the Kst mailing list