03-09-2012 07:02 AM
Kudos to y'all for navigating the fine line wire between helping and doing homework!
Thank you!
Ben
03-09-2012 08:45 PM
So i was able to get my fibonacci numbers to calculate, hoever i can not get them to dislay in a 1D array. any sugguestions?
Thanks
03-09-2012 10:15 PM - edited 03-09-2012 10:18 PM
First you actually have to wire something to the array indicator.
Since it looks like you want to get a result from every iteration, one of your wires will also need to exit the loop as an auto-indexing tunnel.
Another tip is that you can probably get away with only one shift register. If you drag the bottom border of the left hand side shift register downwards, you can get 2 values out. One is the value put into the shift register from the previous iteration (just like normal). The next one down below that is the data that was put into the shift register the iteration before that.
03-10-2012 11:37 AM
So i miss read the problam. It only needed to be a 1D array, so i think i got it.
03-10-2012 11:50 AM
A cosmetic problem is still your representation mismatch. Since you are dealing with integers, the output array should have a blue terminal (I32). You can right-click the array terminal and either select "representation...I32" or "adapt to source".
03-10-2012 11:57 AM
Thanks, Ill fix it now
06-05-2019 05:02 AM
I don't know if it may help ! but i am sharing this VI
I am a beginner .
if you enter a number n then it will produce a fibonacci series upto that number.
ex:
if n=2
output:
0
1
if n=3
output:
0
1
1
06-05-2019 05:21 AM - edited 06-05-2019 05:23 AM
Hi Kushagra,
your implementation lacks in several items:
- way too much case structures: you only need one, when you want to use special cases for n=0,1,2!
- wrong datatypes! Why is the input set to DBL?
- Why do you use I32 for calculation? This limits your allowed input range to ~50. With U64 you can calc upto n=94…
- Why do you use a WHILE loop when the number of iterations is known? Use a FOR loop!
- Why use InsertIntoArray two times, just to prepend two array elements? Use BuildArray!
There are better implementations available in this forum, just search for them!
06-05-2019 06:01 AM
06-05-2019 06:15 AM
Here is another implementation without any case structures or BuildArrays. Works for F0, F1,... to F93