Question: I don't know How to write the commands into Matlab. 1) Powers of Two 28 -256 - 328 210 =1024 Write a Matlab program that


I don't know How to write the commands into Matlab.
1) Powers of Two 28 -256 - 328 210 =1024 Write a Matlab program that uses a for loop and the disp function to print out the first 40 powers of 2. The first 5 lines of your program's output should look like this: 1 2 4 16 2) Collatz Sequence Write a Matlab program that uses a while loop and the disp function to print out the Collatz sequence of an integer n. Here is the algorithm: While n is greater than 1, do the following: If n is even, divide it by 2 to get n / 2. If n is odd, multiply it by 3 and add 1. The first line of your program is given below. Your code needs to work if the value of n is changed. n = 25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
