In: Computer Science
QUESTION 1 Answer the following questions about corrections in Population Models. Question: When you use the “floor(x)” command, you are doing what? (Select the BEST answer) rounding up dividing by a factor which determines the nutation of the answer truncating off the decimal/fractional portion of the number resetting the format command
a .rounding up
b .dividing by a factor which determines the nutation of the answer
c .truncating off the decimal/fractional portion of the number
d .resetting the format command
Question 2
Question: In a Population Model problem which uses monthly time periods, the population at the end of a month is the same as the population before the start of the next month?
True or False
Question 3
Write a MATLAB code to find the number of values between 120 & 230 (inclusive) that are odd and multiples of either 11 or 13.
Store the answers as a single vector “m” with the first number you find meeting the criteria in location m(1), the second number in m(2), and so on. Then display the resulting “m” vector.
Use Matlab
3. A. enter the number of values that your code found between 120 & 230 that are odd and multiples of 11 or 13.
Question (1) Option C is the correct answer.
floor(x) function trucates the decimal portion of x , where as ceiling function ceil(x) rounds up x.
For example let x=3.43 . Then floor(x) = 3 , ceil(x) = 4.
Question (2)
Since you did not provide the population model on which you worked on, I can't decide if the statement provided is true or false. However if the the population of every month is calculated and stored seperately, then the answer is TRUE. If the population of every month is calculated and summed up with previous months data, then answer is FALSE. Please provide the population model, so that we can answer accurately.
Question (3)
Matlab code to code to display all odd numbers between 120 and 230 which are multiples of either 11 or 13 :
count=1;
m=zeros(1,100);
for i = 120:1:230
if rem(i,2)~=0
if rem(i,11)==0
m(count)=i;
count=count+1;
elseif rem(i,13)==0
m(count)=i;
count=count+1;
else
count=count+0;
end
end
end
g=sprintf('%d ',m(1:count-1));
fprintf('%s ',g);
fprintf('\n');
fprintf('The number of numbers that are odd and multiples or either 11 or 13 is : %d',count-1);
The above code checks for all the odd multiple of either 11 or 13 and stores the numbers in a vector m. After searching for all numbers in the range it prints the vector m .
The code also prints the number of numbers that satisfy the condition and the end.
Hope the answer helps you.
Thank you :)