LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need help with convolution sum in Labview

Solved!
Go to solution

Andrey solution is what fits me the best, as your solution @altenbach obtains a convolution in the time domain. My convolution is in the Fourier domain (a multiplication in time), but for the requests of my project, the convolution must be carried out in the fourier domain. 
My input vectors, a and b, are already defined in the Fourier domain

0 Kudos
Message 21 of 27
(401 Views)

@gaiab03 wrote:

Andrey solution is what fits me the best, as your solution @altenbach obtains a convolution in the time domain. My convolution is in the Fourier domain (a multiplication in time), but for the requests of my project, the convolution must be carried out in the fourier domain. 
My input vectors, a and b, are already defined in the Fourier domain


 

They are mathematically equivalent, A convolution in one domain is a multiplication in the other and there is no need to pigeonhole things into time and frequency.

 

If you want to do simple code, here's what you can do:

 

altenbach_0-1732983828199.png

 

Arguably, a single FOR loop is simpler than a stack of loops and the array operation can more easily take advantages of SIMD instructions for more performance. There is also no need for herding cats indices.

 

If it is just a few lines of Matlab code, it should not require a lot of graphical code!

 

 

Message 22 of 27
(399 Views)

On a side note, some might be stumped on how the outer FOR loop in the original solution determines the number of iterations. There is actually an indexing tunnel hidden underneath the shift register! Talk about code obfuscation!

 

(I suspect that was intentional here, but of course does not belong in clear code 😄 )

 

altenbach_0-1732985970314.png

 

Of course all solutions assume that all input arrays have the same size.

 

0 Kudos
Message 23 of 27
(389 Views)

Also note that since all your data is in the imaginary part and integer values, the entire thing could be done in I32 (but be careful with overflow for much larger inputs (values and array sizes!)).

 

Same result!

 

altenbach_0-1732986833037.png

 

 

0 Kudos
Message 24 of 27
(382 Views)

Thank you so much!

0 Kudos
Message 25 of 27
(341 Views)

Hi! @Altenbach I have a problem, when I add in position 0 and 100, a real number equal to 5000 in my a vector:
I should be obtaing something like this and mirrored around 100 and 200:

gaiab03_0-1733138638355.png

But this is what I get:

gaiab03_1-1733138669261.png

I'm using your code

0 Kudos
Message 26 of 27
(319 Views)

@gaiab03 wrote:

Hi! @Altenbach I have a problem, when I add in position 0 and 100, a real number equal to 5000 in my a vector:
I should be obtaing something like this and mirrored around 100 and 200:


I never said that my code is what you need, just that it produces the same as your Matlab code (and Andrey's code). When describing a scenario, make sure to attach a VI with typical data so we can reproduce it.

 

Just throwing words like "this" and "that" and a few images does not tell us what we should be looking at.

0 Kudos
Message 27 of 27
(299 Views)