Matlab hw

profilekuwait94
engr1120_prog1.pdf

ENGR 1120 -Spring 2016

Homework Program 1: Using The 1-D Matrix

Grade Level and Reading Ease Score

Overview :

In this assignment you will practice using 1-dimensional arrays in MATLAB. You will hard- code a set of data into multiple arrays. This data will be used to perform 2 basic computations and the results will be stored in 2 respective new arrays.

Concept Objectives :

• Initialize Array with hardcoded data • Access individual elements of Array • Assign individual elements of Array with computation results

Grade Level and Reading Ease Score :

Two ways to measure how difficult a piece of text is to read are Grade Level and Reading Ease Score. These quantities can be calculated using The Flesch formulas seen below. The number of words, the number of sentences, and the number of syllables contained in a piece of text are used to determine the reading ease score and the appropriate grade level required for the reader. Flesch-Kincaid Readability Test - Wikipedia

ReadingEaseScore = 206.835 − 1.1015 × ASL − 84.6 × ASW GradeLevel = 0.39 × ASL + 11.8 × ASW − 15.59 with

ASL =average sentence length (number of words / number of sentences) ASW= average word length in syllables (number of syllables / number of words)

1

Input Data : The table below shows sample data from 4 books. Your program will compute the Grade Level and Reading Ease Score for each book and save this information in 2 respective arrays.

Data for 4 books:

Name # Words # Sentences # Syllables

Dr. Suess 57 10 58

IRS Code 86 2 162

Thermodynamics text 149 8 264

MATLAB text 127 5 199

Results for 4 books:

Name Reading Ease Score Grade Level

Dr. Suess

IRS Code

Thermodynamics text

MATLAB text

Assignment :

1. Initialize 3 arrays with the data from the table. Give the arrays descriptive names.

2. Calculate ASL and ASW for each book.

3. Calculate Reading Ease Score and Grade Level for each book. This data must be stored in 2 new arrays.

4. Print the results in an easily readable formatted table to the command window. It should be clearly labeled and should contain it Book Name, Reading Ease Score and Grade Level for each book.

5. Bonus Write a MATLAB program that can read a text file and extract the needed data to do the calculations in this lab.

2