turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- I want to evaluate a formula which has complex numbers please help me????

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 06:05 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 06:41 AM - edited 09-05-2013 06:41 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 06:42 AM

Hi!

You could try using a script node (http://zone.ni.com/reference/en-XX/help/371361H-01

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:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 06:45 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 09:55 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-05-2013 10:40 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

09-06-2013 02:00 AM

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 (sometimes even LV2013SP1) on WinXP+Win7+cRIO

Kudos are welcome

GerdW

CLAD, using 2009SP1 + LV2011SP1 (sometimes even LV2013SP1) on WinXP+Win7+cRIO

Kudos are welcome