This MATLAB code prompts the user to input a number, defines variables x and y, displays y, then uses a for loop from 1 to the inputted number minus 1 to calculate the Fibonacci sequence by adding the previous two values and assigning it to z, displaying z, reassigning x to y and y to z on each iteration.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
37 views1 page
Open Sees 2
This MATLAB code prompts the user to input a number, defines variables x and y, displays y, then uses a for loop from 1 to the inputted number minus 1 to calculate the Fibonacci sequence by adding the previous two values and assigning it to z, displaying z, reassigning x to y and y to z on each iteration.