Answer to Question #180845 in MatLAB for Fredrick Moleleki

Question #180845


A security company/Ambulance Service/Fire Service/Police Service wishes to optimally place vehicles in an area such that the response time to any given call within the area is reached within a given time. It also wishes to find the optimal number of security patrol cars to be deployed within the given area. Use a computational geometric approach to develop a code that receives the alarm/homes points, the targeted time to reach the alarm/home and the average speed of cars within the area and identifies where the vehicles can be optimally placed and also determines the number of vehicles required. The alarm/call points (x1, y1), (x2, y2), ..., (xn, yn) are stored in vectors X = [x1, x2, ..., xn], Y = [y1, y2, ..., yn]. Clearly state your assumptions.


1
Expert's answer
2021-04-14T22:42:13-0400
x=randi([1,100],1,10)
Sum = 0; % Initialize
for k = 1 : length(x);
% Accumulate the sum
Sum = Sum + x(k);
% Compute the running mean and print out
end
fprintf('The sum = %.1f, and the average= %.3f\n\n',...
Sum, Sum/k);

fprintf('The Maximum is = %.1f\n\n', max(x));
  
fprintf('After replacing 9th element the list is\n');

x(end-1)=20

fprintf('Average using the build in function = %.1f\n', mean(x));

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS