Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write on matlab please.Here is an example matrix of data: For this example, if there were 2 doses of the vaccine available, the output would
Write on matlab please.Here is an example matrix of data:
For this example, if there were doses of the vaccine available, the output would be:
If there were doses of the vaccine available, the output would be:
In another example, if your matrix of data was:
And there were doses available, the output would be:
Introduction
This project will require you to write a function that handles matrix data using loops and indexing.
You work for a government entity and have been tasked with processing information about vaccine
supply needs. Vaccines are being distributed to people in phases, based on their age, preexisting
conditions, and jobs that place them at risk. Vaccines must be distributed in doses. You have
information about the following:
Anonymous information from people in the vaccine sites region:
o The phase that they are eligible for.
o Whether they have had or doses of the vaccine.
o How many days it has been since the last dose of the vaccine for an individual.
The number of vaccine doses that will be available each day.
You have been tasked with determining a distribution plan for determining which individuals will get the
vaccine on a given day.
Procedure
Write a function that takes inputs:
A xN matrix of data on people in the region. Each column represents a different person.
o Row is eligibility.
o Row is how many doses they have received
o Row is how many days it has been since their last dose. Those who havent had any
vaccine doses will have a in this row.
The number of vaccines available on a day
The function should return one output:
A xN array containing either or
o represents an individual who is to receive a vaccine dose
o represents an individual who will not receive a vaccine dose
Column indices in your input matrix and output array represent the same individuals.
The number of s in your output array should always be equal to the number of vaccines available that
day.
Your function should prioritize lower phase numbers for receiving a vaccine.
Your function should prioritize first doses over second doses for people in the same phase.
You function should only give vaccines to individuals who have received fewer than doses.
Your function should not give vaccines to individuals who have received a vaccine dose within the last
days.
If two people are at the same phase, have the same number of doses, and are able to receive a vaccine
today, but there is only dose left for that day, give the vaccine to the person with the lower column
index.
Hints:
Priorities: Loops and counting variables can be just as important as conditional statements for
implementing priority. You can use loop counting variables to track phase number, for instance.
Remember that your input and output share a column index.
Testing Your Code: Examples
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started