Tobymorgan6909 Tobymorgan6909
  • 20-02-2020
  • Computers and Technology
contestada

Write a script file that creates a row vector v containing all the powers of 2 that are (strictly) less than 103. The output vector should have the form: v = [2, 4, 8, 16 ...]. Use the while loop.

Respuesta :

hamzafarooqi188 hamzafarooqi188
  • 24-02-2020

Answer:

v =[];

%intitialze variable pow with 2

pow = 2;

%repeat the while loop until pow doesn't exceed 1000

while pow <103

   %add pow to v

   v =[v,pow];

   %Generate next number that is power of 2

   pow=pow*2;

end

%Print the row vector

v

Explanation:

Answer Link

Otras preguntas

what unita are used to measure electrical current​
Which of the following statements is FALSE? a. Texans voted overwhelmingly in favor of secession in the special vote set up by President Sam Houston. b. The Te
Describe how communication strengthens relationships at work and. As a result, increases your productivity.
which type of renewable energy described in this lesson do you think holds the most promise?​
Question 22. Which is the correct first step in solving the equation shown?33 - 2x = 31A. Subtract 33 from both sidesB. Add 33 to both sidesc. Add 2 to both sid
Help me plzzzzzzzzz!!!!!!
What process creates the sand dune
Which coice is the correct graph of x < 10?
Where can you find carbon?
The number and location of bones of many fossil vertebrates are similar to those in living vertebrates. This is evidence in support of which of the following co