LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two vectors

Hello everyone 

 

I have a problem with dividing two vectors by matrix.

 

I have two vectors, I am using math script node to multiply and divide these two vectors. for multiply it is ok and the answer is correct but for division it is not. 

 

I did that with linear algebra module but I had the same problem.

 

In " math script.vi " I don't know why the "Aal" amount is a DBL while it is a vector and we have to have an array nut a DBL

 

Would you please help me to find out my error.

 

Download All
0 Kudos
Message 1 of 5
(1,019 Views)

Hi Sml,

 

when you get unexpected results then you should not forget to mention which result you expected!

 

This is what I get by comparing Mathscript node and linear algebra:

 

Btw. it also would help when you attach all needed subVIs and control definitions when you attach VIs like "math script"! It also would help to use better names for your VIs: why does the "matrix" VI also contain just a Mathscript node?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(1,013 Views)

Hello GerdW

 

thank you for your reply.

Please look at attached .vi (it is with out sub vi ).

 

The formula is this : 

Sml2010_0-1630201482580.png

The " Aal " answer is not a vector and this is my problem. How can I have a vector answer?

I changed the data type and select 2D array or Matrix but it didn't change

Would you please help me to find my error in this program?

 

Thank you

0 Kudos
Message 3 of 5
(956 Views)

@Sml2010 wrote:

 

The formula is this : 

Sml2010_0-1630201482580.png


 

(While a 1D array is sometimes called a "vector", nothing says that a 1D array with two elements should represent a vector in the XY (or complex)  plane with the first element representing x and the second y )

 

You have complex numbers, so do complex math using complex data!!!

 

(and no, you don't need Mathscript for any of that!)

 

altenbach_0-1630252769423.png

 

0 Kudos
Message 4 of 5
(930 Views)

Not sure why you have that "round to inf" for you "e" variable. But if you don't really need that, you can eliminate a lot of explicit trigonometry because you can form a complex number from r and theta directly.

 

(if you really need that rounding, you need to form G more explicitly, but can still simplify A and B).

 

altenbach_0-1630256704409.png

 

Or even use array operations to reduce duplicate code (and potentially take advantage of e.g. SIMD instructions) same result!.

 

altenbach_1-1630257255649.png

 

 

Message 5 of 5
(918 Views)