Computers and Technology, 23.03.2020 17:59 lukeperry
Using MatLab: An insect population doubles every generation. Write a while loop that iterates numGeneration times. Inside the while loop, write a statement that doubles currentPopulation in each iteration of the while loop.
I have set up the following code, but it only works for the first and third assessement checks.
function currentPopulation = CalculatePopulation(numGeneration, initialPopulation)
% numGeneration: Number of times the population is doubled
% currentPopulation: Starting population value
i = 2; % Loop variable counts number of iterations
currentPopulation = initialPopulation;
% Write a while loop that iterates numGeneration times
while ( i <= numGeneration )
currentPopulation = currentPopulation * (i * 2);
i = i * 2;
end
% Write a statment that doubles currentPopulation in
% each iteration of the while loop
% Hint: Do not forget to update the loop variable
end
Assessment Checks:
1. CalculatePopulation(2, 5) returns 20
2. CalculatePopulation(10, 4) returns 4096 << This is the one that won't work
3. Calculate Population (0, 78) returns 78
Could someone tell me where I went wrong with my coding?
Answers: 3
Computers and Technology, 22.06.2019 00:30, angoraspinner
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
Computers and Technology, 23.06.2019 00:30, devenybates
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
Computers and Technology, 24.06.2019 06:00, bzhsh8282
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
Using MatLab: An insect population doubles every generation. Write a while loop that iterates numGen...
Chemistry, 08.03.2021 22:30
History, 08.03.2021 22:30
Chemistry, 08.03.2021 22:30
Mathematics, 08.03.2021 22:30
English, 08.03.2021 22:30
Mathematics, 08.03.2021 22:30