Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve for MATLAB P#2. Sequence. Suppose we select some initial number X and then build the sequence of values by the following rules xX1 forXi-1

Solve for MATLAB image text in transcribed
P#2. Sequence. Suppose we select some initial number X and then build the sequence of values by the following rules xX1 forXi-1 even 3x-1+1 forKi-1 odd If Xi-1 is odd, the next element in the sequence grows, and if it is even, the next element in the sequence decreases. For example, with the starting X 17 we have the sequence 17 52 26 13 40 20 10 5 168421 After the sequence reaches 1 it enters the infinite loop 1 42 14 21... Your task is for given numbers to calculate how many steps are necessary to come to 1. For the starting X 17, the number of steps to get to 1 is 12 (i.e., one less the number of sequence elements) Starting value, Number of Steps to reach one 0 3, 10, 5, 16, 8, 4, 2, 1 4, 2,1 5, 16, 8,4, 2,1 6, 3, 10, 5, 16, 8, 4, 2, 1 4 Write code to compute the elements of the sequence for starting values from 1 to 50. Make a plot of the starting value versus the number of steps required to reach 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Organize and support your main points

Answered: 1 week ago

Question

Move smoothly from point to point

Answered: 1 week ago

Question

Outlining Your Speech?

Answered: 1 week ago