Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

HW4

This homework assignment will help you with thefollowing learning objectives:

-      Create and callfunctions

-      Solve linear equations using matrices in MATLAB

-      Use built-in statisticalfunctions

1.    You will be creating a MATLAB script that will do the tasks described in #2 and #3 below.  But first, create a flowchart         visually representing #2 (no need to include #3 in your flowchart for this HW) .  You will be submitting this flowchart             electronically, so please go towww.draw.ioor use any flowchart software of your choice.  Please include a text box with        your name and team number at the top.  Save your file as a .pdf or .jpg. You can also take a screen shot of your flowchart and paste it to a Word document.  Do NOT submit as .xml or .html.

2.    Write a MATLAB script that will find basic statistical information of the dataset, and then use your judgment to come to a conclusion.  The script should:

o  Display this sentence at the start of the program:  “I, (Your Name), certify that I have completed this assignment in an honest manner.”

o  Call a function that will calculate statistical information.  This function will perform the following tasks:

▪    Ask the user to enter the name of a data file.  First, you will run the program using the data file

“Action.txt”, which contains the movie revenues for top action movies (posted in the Canvas organization). Then, you will run the program using the data file Drama. txt”, which contains the top movie revenues for top drama movies.  (Data taken fromhttps://www.the-numbers.com/market/). The rows of the data              represent the movie ID number. For example, row 10 is movie ID 10.

▪    Check whether the filename exists (error check indefinitely).

▪    Load the file.

▪    Find the sum of the movie revenues (use the built-in command).

▪    Find the maximum and minimum movie revenues along with the corresponding movie ID number (use the built-in commands).

▪     Sort the movie revenues from lowest to highest (lowest revenue in the first row use the built-in command), and store the sorted data in a new variable.

o  From the main program, display all results as follows:

▪    “The sum of the movie revenues is #”

▪    “The max revenue is #, corresponding to movie #.  The min revenue is #, corresponding to movie #”

▪    “The sorted revenues are: ”, and display the new variable with the sorted revenues.

▪    First run the program using the Action.txt” data file, and then using the Drama.txt” data file.  Based on the results, what movie genre do people seem to prefer, and how did you come to this conclusion?  Write your response in comments inside your script.

3.    Once you have completed #2, add on to the main program to complete these tasks:

o  From the main program, call a function that will get the data needed to solve a system of linear equations.  You will use the file Eq1.txt”, found in the Canvas organization.  This function will perform the following tasks:

▪    Ask the user to enter the name of a data file.

▪    Check whether the filename exists (error check indefinitely) .

▪    Load the data.

▪    Get the matrix of coefficients (matrix A) and vector b, needed to solve Ax=b.

▪     Send values of A and b to the main.

o  From the main program, call a function that will solve the system of linear equations (Ax=b).  This function will need the variables A and b sent from the main.

o  From the main program, display the result of solving this system of linear equations as follows: “The values, after solving the system of equations, are: ”, and display the resulting vector.

Include a comment with your name at the top.

Include comments, indentation, and whitespace so that your program is neat and understandable to anyone who reads it.

This is an individual submission.  You need to submit the flowchart and the m-files.  Place your m-files and flowchart in a folder and name the folder InstructorLastName_ClassTime_HW4_YourUsername (for example, Balawejder_5pm_HW4_abc123).  Then, you      will need to zip this folder.  To do this, follow these steps: (1) Right click on the folder, go to Send to”, then Compressed (zipped)     folder” (see Image 1), (2) Name your zipped folder the same way you named your regular folder                                                                 (InstructorLastName_ClassTime_HW4_YourUsername), and submit your zipped folder at the start of class, through the assignment     link in your section’s Canvas site.

 

Image 1

You do not need to submit the data files.