06-25-2010 02:50 PM
I dont exactly understand what is going on with my convolution. I am trying to convolve my data with a {+1, -1} wavelet, downsample by 2, and convolve again.
The problem I am having is that if N values of data go in, it comes out with N+1 values. When I set up the VI to process a large data file using a loop, the issue becomes much much larger.
How do I solve the issue with my convolution? What do I have to do after convolving to eliminate the excess?
Solved! Go to Solution.
06-25-2010 03:45 PM
Unfortunately, the 1D convolution (unlike the 2D convolution!) does not have an output control. As an alternative, you can write your own. Both the FFT and direct algorithm are quite trivial.
In the meantime, please support my idea to add output controls to the 1D convolution. 😄
(Only 3 votes so far. Nobody seems to care, maybe cause not many people use convolutions :()
06-25-2010 03:48 PM - edited 06-25-2010 03:50 PM
You were already being helped in your original thread. Please don't create a new thread just to continue the same discussion. People will not know what has already been discussed. This means people will probably suggest something that may have already been suggested, and this doesn't help you.
You should keep the discussion in the original thread. In fact, Zach asked you what was wrong about the convolution, and instead of answering him you created a new thread.
06-25-2010 04:06 PM
So would it be better to convert my 1D data into a 2D and then use the 2D convolution?
I have tried to write my own convolution via FFT and Inverse FFT, but it just does not work out. I've put in both the block and front panel diagrams.
What do you mean by direct algorithm? I was under the impression that the FT method is the definition of the convolution sum? Is there another way to construct a convolution with 1D output control?
Sorry for reposting, it wont happen in the future.
06-25-2010 04:28 PM
@Evilduck wrote:
What do you mean by direct algorithm? I was under the impression that the FT method is the definition of the convolution sum? Is there another way to construct a convolution with 1D output control?
The FFT method is just one way to do it. It is an algorithm, not a definition of the method ;). Have a look at my example (convolution.vi) posted here a while ago.
06-25-2010 04:42 PM - edited 06-25-2010 04:44 PM
OK, to convolute with {1,-1} is much easier with the direct method. Much more efficient if you loop over the shorter array.
Can you attach your simplified VI containing some typical data.
Circular FFT convolution only works correctly if both array inputs have the same size. You are truncating the long fft to only 2 elements at the multiplication (the shorter transform wins!), throwing away most of the data. Think about it!
06-25-2010 05:18 PM
Altenbach,
I've tried running this through your explicit convolution calculation, and the extra term still appears in the sequence.
Here is my VI and some sample data.
The convololve file is one where I tried to run a 2D convolution, but when I restrict to Size X instead of full, the whole thing drops out.
06-25-2010 06:23 PM
You are basically doing a first derivative of the data. There will be an "edge effect", because only N-1 elements overlap. This is expected and you need to decide how to deal with it. There are many possibilities.
06-25-2010 06:39 PM
There is apparently something wrong with the beginning?
I'm sorry, I start with N data values, and after the convolution, i have N+1. Is there any definite way to get N? what do i need to get rid of?
06-26-2010 01:06 AM - edited 06-26-2010 01:07 AM
As I said, a convolution with 1,-1 is just a simple derivative. I don't know why you would jump through all these flaming hoops of advanced signal processing, if all you need is a pairwise difference. Is somebody testing you? 😮
The attached modification shows what I mean. As you can see, the results are identical!