04-22-2024 07:31 AM
I was thinking about something of Fibonacci. I was trying to do this in labview but i doesn't work. Question: How can I create a LabVIEW program that generates a Fibonacci series as output? The program should continue generating Fibonacci numbers until the last element in the series is smaller than a specified input value, which can be provided by the user.
04-22-2024 07:37 AM
Hi Maxim,
maxim.dedeckel@gmail.com wrote:
I was thinking about something of Fibonacci. I was trying to do this in labview but i doesn't work.
What exactly does 2not work"?
" a[i+2]=a[i+1]+a[i+0] " seems easy enough...
maxim.dedeckel@gmail.com wrote:
How can I create a LabVIEW program that generates a Fibonacci series as output?
Use a loop and a shift register...
maxim.dedeckel@gmail.com wrote:
The program should continue generating Fibonacci numbers until the last element in the series is smaller than a specified input value, which can be provided by the user?
Smaller or larger?
04-22-2024 07:42 AM
This sounds a lot like a homework assignment. And since you have shown no effort so far (ie your code), I will give some general ideas.
Use a While loop to continue the sequence. Use a Shift Register to hold the previous iteration value. You can even expand the Shift Register to hold the last two values. Use an Autoindexing Tunnel to build the output array.
04-22-2024 11:17 AM
maxim.dedeckel@gmail.com wrote:
The program should continue generating Fibonacci numbers until the last element in the series is smaller than a specified input value, which can be provided by the user.
For any positive "specified input value", even the first value will be a smaller value, so all you need is a program that generates a zero. Problem solved!
My guess is that you want to generate all numbers that are smaller than a specified input value? That's a very different problem!
Part of any problem solving skillset is the ability to efficiently search this forum (and the internet in general). You might have stumbled e.g. on this post. Of course finding an example is only 1% of understanding it. If you decide to reuse some found code, you need to be prepared to explain every minor detail of the code using your own words. Your teacher knows this forum too.