We will now use your working Collatz code to create a plot like this one on Wikipedia: CollatzPlot Create an array of integers from 1 to 10,000 called x. Then use the collatz function to create...


We will now use your working Collatz code to create a plot like this one on Wikipedia: CollatzPlot<br>Create an array of integers from 1 to 10,000 called x.<br>Then use the collatz function to create another array y of the Collatz stopping time for each entry of x. For<br>example, the 2019th entry in y should be 112.<br>Plotting y vs x will produce the plot shown on the link above.<br>NOTE: If your code is slow or does not finish, remember to use semicolons inside of loops!<br>

Extracted text: We will now use your working Collatz code to create a plot like this one on Wikipedia: CollatzPlot Create an array of integers from 1 to 10,000 called x. Then use the collatz function to create another array y of the Collatz stopping time for each entry of x. For example, the 2019th entry in y should be 112. Plotting y vs x will produce the plot shown on the link above. NOTE: If your code is slow or does not finish, remember to use semicolons inside of loops!
Pick a number, any number (actually, make it a positive integer). Now, let's play a game. If your number is<br>even, divide it by 2. If it is odd, multiply it by 3 and add 1. Repeat this process with your new number.<br>Repeat over and over again. Lothar Collatz in 1937 guessed that this process will always eventually end at<br>the number 1. Write a Matlab function file that takes an input n (assume the user enters a positive integer)<br>and runs through the Collatz process until a 1 is reached. The function should output count, the number<br>of iterations necessary to reach 1. As a test, your code should report that 63 iterations are necessary if we<br>start with the number 2020.<br>

Extracted text: Pick a number, any number (actually, make it a positive integer). Now, let's play a game. If your number is even, divide it by 2. If it is odd, multiply it by 3 and add 1. Repeat this process with your new number. Repeat over and over again. Lothar Collatz in 1937 guessed that this process will always eventually end at the number 1. Write a Matlab function file that takes an input n (assume the user enters a positive integer) and runs through the Collatz process until a 1 is reached. The function should output count, the number of iterations necessary to reach 1. As a test, your code should report that 63 iterations are necessary if we start with the number 2020.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here