LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fibonacci

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.

 
 
 
 
 
0 Kudos
Message 1 of 4
(149 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(145 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(137 Views)

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.

 

0 Kudos
Message 4 of 4
(94 Views)