LabVIEW

Showing results for
Did you mean:

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

Message 1 of 7 (545 Views)

[ Edited ]

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

Message 2 of 7 (533 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:

Message 3 of 7 (531 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.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

The discussions from the Advanced User Track is not over. Join in the conversation: 2016 Advanced Users Track
Message 4 of 7 (529 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.

Message 5 of 7 (499 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

Message 6 of 7 (467 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
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 (+ LV2016 sometimes) on Win7+cRIO
Kudos are welcome
Message 7 of 7 (450 Views)