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 are wood storks considered indicator species?
Which of the following countries is MOST LIKELY to have had a sudden decline in death rate but an increase in birth rate? (5 points) A. Germany B. Canada C. Aus
There are 580 people on an island village. The ratio of females to males is 3:2.Find the number of females in the island village.​
In a shipment of 20 smartphones, 2 are defective. How many ways can a quality control inspector randomly test 4 smartphones, of which 2 are defective?
What is a binomial distribution in short and long terms
Find an equation for the line that passes through the points (5,-4) (-4,-1)
State the contribution and acheivements of mungo park​
Billing code for carcinoma of gallbladder with metastis to abdominal lymph nodes and liver and peritoneal implants
Can you find the correct version please
Suppose y varies directly as x, and y=36 when x=4. Find y when x=11. A. 99 B. 1 C. 13 D. None of the answers are correct