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

Why is it important for professionals in any field to be accurate and precise with their data collection??
f(x) = 3x2 - 11 Find f(-5)
How are emotional and intellectual health related?
Which is an example of an operating system?? HELP ASAP
b. What were the results of the war between Native Americans and English settlers in 1675? Student Summary:
guys u are giving me the wrong answers and u guys dont know any of them whats the point going on here and the only u guys do giving people the wrong answers wha
Why was the Fourteenth Amendment written?
Below are 2 parallel lines with a third line intersecting them. What is the value of x?
6(5-8x)+12=-54What is the value of X?​
On a shelf sits a bottle of NaCl solutions with a molar concentration of 2.50 M and a total volume of 300 mL. If 15.0 mL of the solution is added to 985 mL of p