Question: matlab Problem 2.(10 pts) Create a script file named 'Seq'. Follow the procedure below to generate vectors v: v(i+1)=v(i)/2 if v(i) is an even integer
Problem 2.(10 pts) Create a script file named 'Seq'. Follow the procedure below to generate vectors v: v(i+1)=v(i)/2 if v(i) is an even integer and v(i+1)=3*v(i)+1 if v(i) is an odd integer; stop at achieving 1. Generate 4 such vectors with initial values 49, 50, 99, 100, named as vl, v2, v3, v4. Plot these vectors on a single figure with the colors red, blue, green, black and the markers circle, triangle, square and star (use index 1,2,... as the x coordinates and the vector values as the y coordinates). You should plot totally 4 connected curves
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
