Answer To: Hertzsprung–Russell diagram MATH 210-01, Fall 2021 Ryan Pellico, Department of Mathematics, Trinity...
Nishchay answered on Oct 06 2021
Assignment Solution
1) Matlab code to change the axis limits
1. close all; % close all open figure
2. clc;clear all; % clear command window and work space
3. % the function xlsread imports data from an Excel spreadsheet by taking as
4. % an input the filename of the Excel spreadsheet as a character array '...'
5. % or string "...". The spreadsheet must be in the Current Folder, and the
6. % function outputs up to three arrays, NUM contains the purely numerical
7. % data, TXT contains the purely text data, RAW contains all the data (in a
8. % cell array).
9. [NUM,TXT,RAW] = xlsread('HR_star_data.xlsx');
10.
11. % column 1: star ID number (we don't need this)
12.
13. % column 2: apparent V magnitude (extract this column and call it m)
14. m = NUM(:,2);
15.
16. % column 3: observed B-V color (extract this column and call it c)
17. c = NUM(:,3);
18.
19. % column 4: observed parallax (extract this column and call it p)
20. p = NUM(:,4);
21.
22. % column 5: parallax uncertainty (in milliarcsec) (we don't need this)
23.
24.
25.
26. % Create new column of absolute magnitude (M) using m and p.
27. M = m + 5*(log10(p)+1);
28.
29.
30.
31. % scatter(x, y, size, color, marker)
32. scatter( c, M, 3, c, 'o', 'filled')
33.
34. % x-axis limit from -0.5 to 2.25
35. xlim([-0.5 2.25]);
36.
37. % y-axis limit from -10 to 20
38. ylim([-10 20]);
39.
40. % use set(gca,'Name','Value') to change features of the "axis"
41. set(gca,'Color',[0 0 0],'XColor',[1 1 1],'YColor',[1 1 1]);
42. set(gca,'Ydir','reverse','FontSize',14);
43.
44. % use set(gcf,'Name','Value') to change features of the "figure"
45. set(gcf,'Color',[0 0 0]);
2) Matlab code for title and label the axis
1. close all; % close all open figure
2. clc;clear all; % clear command window and work space
3. % the function xlsread imports data from an Excel spreadsheet by taking as
4. % an input the filename of the Excel spreadsheet as a character array '...'
5. % or string "...". The spreadsheet must be in the Current Folder, and the
6. % function outputs up to three arrays, NUM contains the purely numerical
7. % data, TXT contains the purely text data, RAW contains all the data (in a
8. % cell array).
9. [NUM,TXT,RAW] = xlsread('HR_star_data.xlsx');
10.
11. % column 1: star ID number (we don't need this)
12.
13. % column 2: apparent V magnitude (extract this column and call it m)
14. m = NUM(:,2);
15.
16. % column 3: observed B-V color (extract this column and call it c)
17. c = NUM(:,3);
18.
19. % column 4: observed parallax (extract this column and call it p)
20. p = NUM(:,4);
21.
22. % column 5: parallax uncertainty (in milliarcsec) (we don't need this)
23.
24.
25.
26. % Create new...