LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplying arrays

Hi 

I am trying to multiply two arrays, each element in one array with the corresponding element in the other. but I could not get the result I want.

for example:   1 -1 i * 0,834027 -0,834027 i  =  1-1.6681i  (must be like that )

but in the blocks below it is shown  1 -1 i * 0,834027 -0,834027 i  =  0 -1,66805 i

and I face this problem with the other multiplying elements.

0 Kudos
Message 1 of 7
(310 Views)

Hi Husam,

 


@HUSAM2324 wrote:

for example:   1 -1 i * 0,834027 -0,834027 i  =  1-1.6681i  (must be like that )

but in the blocks below it is shown  1 -1 i * 0,834027 -0,834027 i  =  0 -1,66805 i

and I face this problem with the other multiplying elements.


Maybe your expectation is wrong?

 

And maybe your math is wrong? Maybe you forgot to use some parentheses?

(www.symbolab.com)

 

Btw. it would help when you downconvert your VI to LV2021 or older before posting. (I prefer LV2019.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
0 Kudos
Message 2 of 7
(300 Views)

It is distracting from the question if you blame "arrays", yet the problem has nothing to do with arrays. You get the same result when multiplying two complex scalars. The result is correct.

 

Your code is also overly complicated. Assuming the two arrays have the same size, the following code would do the same.

 

altenbach_0-1709112355335.png

 

 

 

 

0 Kudos
Message 3 of 7
(286 Views)

you are right. thank you so much 

0 Kudos
Message 4 of 7
(270 Views)

The problem was that because the imaginal part and the real part are the same (0,834027 -0,834027 i), the result was just imaginal. thank you for every one . 

I have another question, Can I make more simple block system for random complex numbers than the one the example below ?

0 Kudos
Message 5 of 7
(267 Views)

Hi Husam,

 

again you forgot to downconvert the VI before posting. (File->Save for previous.)

I still prefer LV2019...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(263 Views)

@HUSAM2324 wrote:

I have another question, Can I make more simple block system for random complex numbers than the one the example below ?


Please NEVER (never ever!) attach a new VI with exactly the same filename as a VI posted earlier! Also try to avoid terms such as "block system", something that nobody ever heard of.

 

Let's look at your "block diagram":

 

altenbach_0-1709136258669.png

 

 

Why do you have two "samples" and two standard deviation inputs. Of course the "samples" need to be the same, so one control is sufficient. An array control ( [X] does NOT belong inside the loop unless you expect it to change during the loop execution. If the control is inside the loop, the compiler needs to assume that it can change and will create a lot of overhead re-reading the control with every iteration. Why do you generate 128 samples, but only use 7 in the FOR loop? Why are there some many wire bends? (Do you know how to change the default values of controls? Do you know the various types of tunnels? Do you know what that red coercion dot means?, "x+y2" or "Array" are not an intuitive labels for terminals. etc.)

 

The size of the random array should probably match the size of the X array, right?

 

Maybe all you need is the following:

 

altenbach_0-1709135872805.png

 

 

You really (really!!!!) need to start with a few basic tutorials before digging yourself into a deeper and deeper hole! There are plenty of learning resources listed at the top of the forum.

 

 

0 Kudos
Message 7 of 7
(213 Views)