LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to evaluate a formula which has complex numbers please help me????

I'm a begineer in labview. I want to evaluate an equation which has complex numbers through text code.. Any suggestions Please????

 

for(f=0;f<=2560;f=f+0.3125)

{

     R=((H12-e^(-i*k))/(e^(i*k)-H12))*e^(i*k);

}

 

where H12 is 1d array of complex number

            i         square root of -1

            k         function of frequency

            f          frequency

 

0 Kudos
Message 1 of 7
(3,101 Views)

Just use a For-loop in combination with a 1d-array of complex numbers. The following example shows the usage of a array of complex numbers:

 

https://decibel.ni.com/content/docs/DOC-28831

 

Or is there any other problem?

 

Regards,


Michael

0 Kudos
Message 2 of 7
(3,089 Views)

Hi!

You could try using a script node (http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/scriptnodes/) if you have MATLAB installed on your PC.

 

Or you can implement it in Labview, since there is a Complex data type (actually more than one).

Here's a snippet as a draft/starting point:

 

complex.png

 

0 Kudos
Message 3 of 7
(3,087 Views)

Would you know how to do this if they weren't complex numbers?  If so, then all you have to do is change the numberic representation to a complex data type.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(3,085 Views)

@girikavali wrote:

I'm a begineer in labview. I want to evaluate an equation which has complex numbers through text code.. 

 


Are you saying you don't want to use LabVIEW to evaluate this? In which case I suggest asking on a different forum.


for(f=0;f<=2560;f=f+0.3125)

{

     R=((H12-e^(-i*k))/(e^(i*k)-H12))*e^(i*k);

}


There is no 'f' in the loop, I don't understand what the loop would evaluate, unless k is a constant in which case the loop is redundant.

 


            k         function of frequency

            f          frequency 


If k is a function of frequency you need to say what that function is. For example if you are evaluating 'k' for changing 'f' and applying it to the equation for R. I don't know what the best procedure would be but my first port of call would be nested loops: 'R' for each 'k' for each 'f' ?

In the absence of a function for k this vi would evaluate you formula for k=f, I don't know if this wil help any.

complexfun.png

0 Kudos
Message 5 of 7
(3,055 Views)

Thank you Marco Mauri & Michael for your sugesstions..

 

I have implemented it by using loop as you said, but it looks little bit messy, and it becomes difficult to debug,

 

So, script node will be  a better choice. since in my program there are many such equations.

 

I don't have matlab installed in my PC, but i have scilab installed can i use it, If possible i want to know the syntax...

 

Thanks and Regards,

Giridhar

0 Kudos
Message 6 of 7
(3,023 Views)

Hi girikavali,

 

- when the VI looks messy you should clean it up (there even is the automatic cleanup tool...)

- What means "difficult to debug"? A script node / formula node / scilab node is even more difficult to debug...

 

Best regards,
GerdW


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