project1_csc113_2024sp_ver3

pdf

School

North Carolina State University *

*We aren’t endorsed by this school

Course

113

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

8

Uploaded by MasterMantis3844

Report
Project 1 - CSC 113 Introduction to MATLAB, 2024 SPRING ver3 Near-Earth Objects and Fireballs Near-Earth Objects (NEOs) are comets and asteroids redirected by nearby planets' gravitational forces into orbits that bring them close to Earth. Comets, mainly composed of water, ice, and embedded dust, originated in the outer planetary system, while rocky asteroids formed in the warmer inner solar system between Mars and Jupiter. The scientific interest in asteroids is due largely to their status as the remnant debris from the inner solar system formation process. Because some of these objects can collide with the Earth, asteroids are also important for having significantly modified the Earth's biosphere in the past and they will continue to do so in the future. In addition, asteroids offer a source of volatiles and an extraordinarily rich supply of minerals that can be exploited for the exploration and colonization of our solar system. ( 1 ). In this assignment, you’ll be analyzing data about NEOs that comes from NASA’s Jet Propulsion Laboratory Center for Near Earth Object Studies . Specifically, you will be working with data about the 1) Close approaches by NEOs and 2) Fireballs , an astronomical term for exceptionally bright meteors that are spectacular enough to to be seen over a very wide area. To learn more about these, watch a Video Tutorial on NEOs Data and read this Introduction to Fireballs . Note that the data has been slightly edited to make it easier to process for this project. To complete this project, follow this outline: 1 Project Requirements 2 Design & Implementation 2.1 Script Name 2.2 Load the Input Data 2.3 Analyzing NEOs 2.4 Analyzing Fireballs 3 Testing your code 4 Submission 5 Grading Rubric 1 Project Requirements Your code must first load NEOs-related data from the input files into MATLAB. Next, your code will analyze the data and generate the following types of output: 1) printed output to the Command Window and 2) plots in a Figure Window. Before you start working on this project, read this entire document. Start by looking at the following Example Runs that show you how the program should be working. 1
Example Run#1: Near-Earth Objects(NEOs) This example run shows the expected output for the input file that contains the data about the NEOs. This is the printed output seen in the Command Window . The user selects to analyze the NEOs. and the generated Figure with the two subplots is: 2
Example Run#2 - Fireballs This example run shows the expected output for the input file that contains the data for the fireballs. This is the printed output seen in the Command Window . In this example, the user wants to analyze fireballs and picked the year 2022. and the generated Figure with two subplots is: 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2 Design & Implementation In order to generate this printed output and plot, follow these detailed steps. 2.1 Script Name Your code for this project shall be in a single script named neosAnalyzer.m . You will lose points if your script is named differently. Capitalization is important too. (These details really help us during grading!) 2.2 Load the Input Data There will be two different Microsoft Excel (.xlsx) spreadsheets. The first spreadsheet contains the NEOs data, and the format is: Object: the name given to this NEO Date : date and time of closest Earth approach Year : the year when the NEO will closely approach the Earth Distance (AU) : close-approach distance from Earth in astronomical units (AU) V : velocity relative to Earth at close-approach in km/s H : asteroid absolute magnitude (in general, smaller H implies larger asteroid diameter). Diameter : max estimated diameter in meters Rarity: h ow infrequent the Earth close approach is for asteroids of the same size and larger: 0 is 100 per year, 1 is once a month, 2 is once a year, 3 is once a decade The figure below shows the first rows of this spreadsheet: neosData.xlsx The second spreadsheet contains the Fireballs data, and the format is: Peak Brightness Year: the year of the fireball's peak brightness. Peak Brightness Month: the month of the fireball's peak brightness. Latitude (deg.): geodetic latitude in degrees north (N) or south (S) of the equator Longitude (deg.): geodetic longitude in degrees east (E) or west (W) of the prime meridian Altitude (km): altitude in kilometers (km) above Earth for the fireball Velocity (km/s): pre-impact velocity in kilometers per second (km/s) Radiated Energy (J): approximate total radiated energy in the atmosphere in Joules Impact Energy (kt): the impact energy of the fireball in kilotons of TNT (kt) 4
The figure below shows the first rows of this spreadsheet fireballsData.xlsx Implementation Details: Load the input data from these spreadsheets into MATLAB, by using the built-in command readmatrix . This command will load ONLY the numeric data, so you don’t have to worry about the text. When the data is loaded, some of the columns will show as NaN. You can ignore these NaN columns as they are not needed to complete the analysis. We might grade your project with ANY input Excel spreadsheet that has this same column-based format, so don’t hardcode the number of rows ! In other words, the columns will stay the same (e.g. the 3rd column will always contain the Year in the NEOs data file); however, if we update the input file to have rows for 2024, your code should be able to work for this different number of rows. Use the user’s input on what analysis they want to do (NEOs or Fireballs) and ONLY load that specific file to analyze. You may assume the user will only enter valid input (1 or 2). Use an if statement OR switch statement to load the specific input data. Write code that analyzes ONLY ONE file at a time to make the code efficient . Points will be deducted if you hardcode and analyze all two input files at the same time. 2.3 Analyzing NEOs Utilizing built-in MATLAB functions, calculate the values AND print them to the Command Window . Print all the values up to 2 decimal places . NEOs Printing A. Print Statistics about the Avg, Max, and Min for the Distance from Earth (km) . Convert the Distance from AUs to km, where 1AU = 1.496*10^8 km B. Print Statistics about the Avg, Max and Min for the Diameter (m) . C. Print information about the Closest NEO: year, km from Earth and Diameter (m) D. Print information about the Biggest NE): year, km from Earth and Diameter (m) NEOs Plotting Generate a single Figure that has two subplots for the following: E. Subplot#1 shows the Number of NEOs by Year of when they will have close approach a. Use the built in function histogram b. Use the default color for this plot in Matlab, i.e. no need to set the color of the histogram. c. Add a title d. Label the x-axis and y-axis F. Subplot#2 shows the biggest diameter NEOs by the Year of when they will have close approach 5
a. Determine the NEOs that had the following diameters i. BigNEOs: GREATER than 1000m to LESS than or EQUAL to 2000m ii. BiggestNEOs: GREATER than 2000m Implementation Detail: to achieve this, consider using logical indexing b. Plot the BigNEOs with Black Asterisks c. Plot the BiggestNEOs with Red Circles d. Label the x-axis and y-axis e. Add a title f. Add a legend 2.4 Analyzing Fireballs Utilizing built-in MATLAB functions, calculate the values AND print them to the Command Window . Print all the values up to 2 decimal places . Fireballs Printing A. Print Statistics about the Fireball with the lowest Altitude to Earth: year, km from Earth, and impact energy (kt). B. Print Statistics about the Fireball with the Highest Impact Energy: year, km from Earth, and impact energy (kt). Fireballs Plotting The plotting for the fireballs is done for a specific year in a single Figure that has two subplots: C. Ask the user for a specific year for which they would like to plot the fireballs. It is OK to hardcode that the years are from 1997 to 2023 . You may assume the user will always enter a valid year (i.e. the user will always enter a number between 1997 and 2023). D. Subplot#1 shows the Altitude for the fireballs in that specific year a. Plot without using a line to connect the data points i. Markers should be black asterisks ii. Set the property 'Markersize' to be 10, read Mathworks Documentation b. Label the y-axis, including the units c. Label the x-axis with the months d. Add title e. Add grid E. Subplot#2 shows the Impact Energy for the fireballs in that specific year a. Plot without using a line to connect the data points i. Markers should be red diamonds ii. Set the property 'Markersize' to be 10, read Mathworks Documentation b. Label the y-axis, including the units c. Label the x-axis with the months d. Add title e. Add grid Implementation Detail: To label the x-axis as months, use the following code AFTER your plot command. This code will create 12 ticks on the x-axis and label them appropriately. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3 Testing your code Make sure that your code behaves as specified in this document. Here are a few ways that you can test your code: Check and compare your outputs to the two Example Runs in Section 1. Your outputs should match the example runs exactly. Make sure that you suppress ALL unnecessary output in your script. No additional printing should be seen in the Command Window. Your script shall work with any other input files that have the same column-based format. The teaching staff might use different input files to grade your code. Therefore, don’t hardcode values whenever possible. Check that your project satisfies the Grading Rubric for this project. 4 Submission This project is due Tuesday, February 6 th , 2024 at 2:00pm (one hour before the Tuesday session). 4.1 Project Partners assigned from the same Lab section by the Lab TAs. Fill out this Project#1 Partner Preference Google Form (also linked on Moodle) by 5pm Sunday 1/21/23 to let us know if you like to work with a partner or if you prefer to work alone. Everyone has to fill out this form! 4.2 Styling Directions For this assignment you will create one .m-file called neosAnalyzer.m At the top add the following header: % Name(s): (of both students if working in a group!) % Email(s): % Date: % Lab Section # % Project 1: NEOs and Fireballs Analysis, Spring 2024 clc ; clear ; close( ‘all’ ); You should add comments for every 2-4 lines of code Make sure to add cell blocks to your code. A good outline would be to add a cell block for each section of the write-up. 4.3 Submission You will submit the project via the link on Moodle called Project 1 Submission , which will take you to the Gradescope Project 1: Submission link. ONLY ONE student per team submits the project files -- we don’t want the same code submitted twice! Submit just one file: neosAnalyzer.m . (Do NOT submit any .xlsx or .asv files.) After you submit the Project Files -- add your partner’s name to the submission in Gradescope (See this Gradescope Tutorial ). The submitter’s name will be automatically added to the submission, but if you don’t add your partner’s name, then they won’t get a grade for Project 1! 7
4.4 Early Submissions Early submissions will receive extra points on the assignment depending on the date on which they were submitted. The early submission points given are as follows: Submissions by 11:59 PM on 1/23/2024 receive 5 extra points. Submissions by 11:59 PM on 1/30/2024 receive 3 extra points. 4.5 Late Submissions If you have to submit your project late, complete the Tokens & Extension Form in Moodle. We will use the Late Submission policy as specified in the CSC113 Syllabus . 5 Grading Rubric This is how your project will be graded: Points Description (18pts)Input 6 Print Options and get user’s input 6 Correctly loading the data the chosen input file 6 Correctly extracting only the needed columns of data (42pts) NEOs Analysis 5 2.3A Stats about Distance from Earth 5 2.3B Stats about the Diameter(km) 5 2.3C Closest NEO 5 2.3D Biggest NEO 7 2.3E Plot Histogram of NEOs by Year 15 2.3F Plot biggest diameter NEOs (40pts)Fireballs Analysis 5 2.4A Lowest Altitude 5 2.4B Highest Energy 6 2.4C User Selecting the Specific Year to plot 12 2.4D Plot Altitude for Specific Year 12 2.4E Plot Impact Energy for Specific Year Points Description -2 Name(s), date, section, etc. not included at the top of each .m file -5 Incorrectly Named File ( neosAnalyzer.m ) -5 Code is not well commented (every 2-4 lines) -5 Code is not cell blocked (by section!) -5 Additional, irrelevant output displayed to the Command Window +5 Submitted by 11:59 PM on 1/23/2024 +3 Submitted by 11:59 PM on 1/30/2024 late Use Slip-Day Tokens, as outlined in the CSC113 Syllabus . Below are the changes to the project between the different versions. Changelog Version Number Release Date Summary of changes ver1 1/18/2024 Initial version ver2 1/22/2024 Fixed grammar and spelling errors. 2.3.F the diameters of the NEOs are in meters (there was a typo that said kilometers) ver3 1/24/2024 Fixed all the diameter to be in meters. (Example Run#1 and Sec 2.3) 8