NewUser Posted November 7, 2008 Report Share Posted November 7, 2008 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. Quote Link to comment
jgcode Posted November 7, 2008 Report Share Posted November 7, 2008 QUOTE (NewUser @ Nov 6 2008, 10:28 AM) 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. Hi New User, you can do the above but getting all the elements (array) then summing them outside of the loop. (Numeric>>Add Array Elements) http://lavag.org/old_files/monthly_11_2008/post-10325-1225940554.png' target="_blank"> Quote Link to comment
NewUser Posted November 7, 2008 Author Report Share Posted November 7, 2008 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?? Quote Link to comment
jgcode Posted November 7, 2008 Report Share Posted November 7, 2008 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). Quote Link to comment
NewUser Posted November 7, 2008 Author Report Share Posted November 7, 2008 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 Quote Link to comment
jgcode Posted November 7, 2008 Report Share Posted November 7, 2008 QUOTE (NewUser @ Nov 6 2008, 12:09 PM) 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 Here's both using your code http://lavag.org/old_files/monthly_11_2008/post-10325-1225945369.png' target="_blank"> Quote Link to comment
NewUser Posted November 7, 2008 Author Report Share Posted November 7, 2008 QUOTE (jgcode @ Nov 5 2008, 11:23 PM) Here's both using your code http://lavag.org/old_files/monthly_11_2008/post-10325-1225945369.png' target="_blank"> Thank you so much! I feel so silly asking all these dumb questions! But seriously, thank you for taking the time to answer my question. I really appreciate it What is the purpose of the shift register? Quote Link to comment
jgcode Posted November 7, 2008 Report Share Posted November 7, 2008 QUOTE (NewUser @ Nov 6 2008, 12:33 PM) Thank you so much! I feel so silly asking all these dumb questions! But seriously, thank you for taking the time to answer my question. I really appreciate it :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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.