Question: . BEFORE YOU WRITE YOU PROGRAM, WRITE AN ALGORITHM WITH THE STEPS FOR SOLVING THE PROBLEM. INCLUDE THE FOLLOWING SECTION HEADINGS IN YOUR ALGORITHM. Algorithm

.

BEFORE YOU WRITE YOU PROGRAM, WRITE AN ALGORITHM WITH THE STEPS FOR SOLVING THE PROBLEM. INCLUDE THE FOLLOWING SECTION HEADINGS IN YOUR ALGORITHM.

Algorithm: Type your algorithm as comments in the editor window.

Use the comments as a guide to type the MATLAB statements in assign07.m.

%*****CONSTANT***** %*****INPUT***** %*****COMPUTE***** %*****OUTPUT*****

Problem:

Engineers use both English and SI (Systeme International dUnites) units on a regular basis. Some fields use primarily one or the other, but many combine the two systems. For example, the rate of energy input to a steam power plant from burning fossil fuels is usually measured in Btu/hour. However, the electricity produced by the same plant is usually measured in joules/s (watts). Automobile engines, by contrast, are often rated in horsepower or in ft lbf/s. Here are some conversion factors relating these different power measurements:

1 kW = 3412.14 Btu/h = 737.56 ft lbf/s

1 hp = 550 ft lbf/s = 2544.5 Btu/h

(Moore 4e, 7.14) Instructions for all assign scripts:

See Standards for Documentation of MATLAB Programs on the Canvas Resources page.

Insert comments at the top and throughout each file.

Include the follow comments at the beginning of this (and ALL) files.

Use the algorithm given as comments throughout your program. -5 points for absence of any of

Observe the instructors rule for naming variables. these required comments at the o Use ALL CAPS for constants variable names. top at the top of each file. o Start other variables with lower case. o Use descriptive variable names.

Use Sample Input/Output as a guide.

Program: assign07.m

Re-write your assign06.m using user defined functions. Some requirements have been and or removed.

Use the given function names for the functions. You may reuse the variable names in your assign07.m

function [ kw ] = readFile( nRows, nCols, fileID ) % read file into kw matrix function [ btu_per_hour, ft_lbf_per_sec, hP ] = compUnits( kw ) % convert kw to Btu/h, hp, ft lbf/s function [ ] = printUnits( kw,btu_per_hour,hP,ft_lbf_per_sec ) % print power conversion table

In assign07, open the data file in assign07.m.

and only call the functions to do the tasks, if the file is available.

In readFile, read 'kilowatt.txt' one

number at a time and build a 4x3 matrix of kilowatt values using (row,col) indexing in nested for loops.

3-In compUnits, convert the kilowatt values to btu/h, hp, and ft lbf/s 4x3 matrices.

4-In printUnits, print the four 4x3 matrices in columns with a title and column headers. See output below.

Problem Constants: (with units as needed) Filename 'kilowatt.txt'

Number of rows (4) and columns (3)

Problem Inputs: (with units as needed)

Kilowatt values

Problem Outputs: (with units as needed) btu/h hp

ft lbf/s

Other variables: (with units as needed)

As needed

Equations:

See above.

Output:

Power Conversion Values kW Btu/hr hP ft lbf/s 115.5 394110.7 154.9 85190.0

29.9 102016.5 40.1 22051.6

98.2 335010.0 131.7 72415.0

18.7 63976.6 25.1 13829.0

66.0 225079.8 88.5 48652.7

59.3 202288.4 79.5 43726.2

115.7 394943.9 155.2 85370.1

104.2 355403.7 139.7 76823.2

99.0 337902.2 132.8 73040.1

111.2 379266.9 149.1 81981.4

83.9 286117.5 112.4 61846.5

113.1 385808.3 151.6 83395.4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!