02-28-2024 02:59 AM
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.
02-28-2024 03:20 AM - edited 02-28-2024 03:22 AM
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?
Btw. it would help when you downconvert your VI to LV2021 or older before posting. (I prefer LV2019.)
02-28-2024 03:26 AM
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.
02-28-2024 03:58 AM
you are right. thank you so much
02-28-2024 04:05 AM - edited 02-28-2024 04:10 AM
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 ?
02-28-2024 04:06 AM
02-28-2024 10:01 AM - edited 02-28-2024 10:10 AM
@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":
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:
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.