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

The mass of an object is measured to be 55.6 g. Its volume is measured to be 48.5 mL. What is the object's density? Show the work.
How can an individual’s value contribute to a community’s foundation of success
The town of Tola has a population of 45,000 and produces 6 tons of garbage each week. Express this information in terms of the function f
20,000 is 10 times as much as
Nina can ride her bike 63,360 feet in 3,400 seconds, and sophia can ride her bike 10 miles in 1 hour. What is nina’s rate in miles per hour if there are 5,280 f
In the Colonial period, Quakers were known for all of the following EXCEPT their a. acceptance of a greater role for women in public worship b. opposition to th
If y varies inversely as x, and y = 14 when x = 8, find y when x = 7.
Write a report writing of your family
What is 3.242424 as a mixed number
-6xy + 5xy -4x²y can someone pls find the answer pls ._.