Question: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%Reading in Data and setting Constants %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load('planets.mat'); %%The data are stored in the planets.mat file. %%run this code and check out the Workspace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Reading in Data and setting Constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load('planets.mat');
%%The data are stored in the planets.mat file.
%%run this code and check out the Workspace to see what gets loaded in.
%%Here is the information you need:
%names_pl - a cell array storing the names of each planet
%rad - an array of doubles storing the radius of each planet in miles
%orb - an array of each planet's orbit in days
%temp - an array of each planet's equilibrium temperature in Kelvin
%dist - an array of the distance from each planet to its sun in
%units of Solar Radius
rad_earth=3959; %miles
rad_superearth=2*rad_earth; %miles
rad_neptune=15299; %miles
rad_jupiter = 43441; %miles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Part 1 - Bin planets by size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bin=zeros(1, 5); %initialiing the arrays of bins
%(1)the first index should hold number of planets with
%a radius less than or equal to the earth's radius
%(2)the second index should hold the number of planets
%with a radius greater than earth's radius and less
%than or equal to super earth's radius
%(3)(4)(5)etc.
%TO DO: Fill this in
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Part 2 - find habitable planets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ind_habitable=[]; %fill this array with the indices of all planets
%that are potentially habitable
habitable_exoplanets = []; %fill this array with the names of all
%planets that are potentially habitable
%TO DO: Fill this in
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Part 3a - remove planets without size data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
remove = []; %fill this array with all indices of planets that
%do not have size data (have a radius=NaN)
%you will use this array to remove all these elements
%from rad and names_pl (change these arrays)
%TO DO: Fill this in
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Part 3b - sort planets by size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ind_sort = []; %fill this array with all indices sorted by
%size from largest to smallest. For example
%array = [4.0 5.4 3.1 2.8 6.4], then
%ind_sort = [5 2 1 3 4]
names_pl_sorted = []; %fill this array with the names of the
%planets (only the ones with non-NaN
%sizes) in sorted order from largest
%to smallest;
%TO DO: Fill this in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
