Jump to content

Summation


NewUser

Recommended Posts

hi guys!

I'm relatively new to all of this and am trying to figure it out. I need to perform a summation from i=0 to M of i/(i+1)..since i starts at 0, there are m+1 terms. I'm using a for loop. I made N=25 (i want M to run to 25). I added i and 1 using a <+> and then divided i by (i+1)...that's all i have. if i just have an output, i get the last calculation instead of a summation of the entire thing. how can i fix this.

i apologize for my bad terminology, i really don't know what i'm talking about.

Link to comment

QUOTE (NewUser @ Nov 5 2008, 09:28 PM)

hi guys!

I'm relatively new to all of this and am trying to figure it out. I need to perform a summation from i=0 to M of i/(i+1)..since i starts at 0, there are m+1 terms. I'm using a for loop. I made N=25 (i want M to run to 25). I added i and 1 using a <+> and then divided i by (i+1)...that's all i have. if i just have an output, i get the last calculation instead of a summation of the entire thing. how can i fix this.

i apologize for my bad terminology, i really don't know what i'm talking about.

if i use my current configuration and try to attach the summation thing, it says i've connected terminals of two different types??

Link to comment

QUOTE (NewUser @ Nov 6 2008, 11:11 AM)

if i use my current configuration and try to attach the summation thing, it says i've connected terminals of two different types??

You are passing in a scalar value, but it requires an array (multiple scalar values).

Either add to the scalar value using the shift register in the loop to get the sum (your example)

Or get the sum of the array of elements using auto-indexing outside of the loop (as per example).

Link to comment

QUOTE (jgcode @ Nov 5 2008, 10:43 PM)

You are passing in a scalar value, but it requires an array (multiple scalar values).

Either add to the scalar value using the shift register in the loop to get the sum (your example)

Or get the sum of the array of elements using auto-indexing outside of the loop (as per example).

could you show me the final one..using my example? i can't get it to work, but i still want to use the same inner configuration

Link to comment

QUOTE (NewUser @ Nov 6 2008, 12:33 PM)

:beer: Well you have to start somewhere.

QUOTE (NewUser @ Nov 6 2008, 12:33 PM)

What is the purpose of the shift register?

To store the last value (n-1) from the previous iteration

You can also click on it and drag it down to get n-2, n-3 etc...

Go to the LabVIEW Help and do a search to find out more about it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.