MATLAB: A Practical Introduction to Programming and Problem Solving
MATLAB: A Practical Introduction to Programming and Problem Solving
5th Edition
ISBN: 9780128163450
Author: ATTAWAY
Publisher: ELSEVIER
bartleby

Videos

Question
Book Icon
Chapter 9, Problem 9.1P
Expert Solution & Answer
Check Mark
To determine

To modify:

The script “fileex” to sum the numbers from the file and create a file in this format first.

Answer to Problem 9.1P

Solution:

The script is saved and executed as follows.

Explanation of Solution

MATLAB Code:

fid = fopen('subjexp.dat');

%Define the instruction to read information from "subjexp.dat" and open them.

if fid == -1

disp('Unsuccessful; The file is not opened')

%Define the instruction to display the unsuccessful result.

else

SUM = 0;

while ~feof(fid)

Number = strtok(fgetl(fid));

SUM = SUM + str2double(Number);

%Define the instruction to separate each line into the number code and %converts to a number before printing.

end

closeresult = fclose(fid);

%Define the instruction to check the file close for success.

if closeresult == 0

disp('successful: File is closed')

else

disp('Unsuccessful: File does not close')

%Define the if-else statement to check the condition for closing the

%file, and display the relative statement.

end

end

fprintf('The total sum of the numbers is: %.2f\n', SUM)

%Define the instruction to create the total sum of the numbers.

Save the MATLAB script with name, chapter_9_54793_9_1P.m in the current folder. Execute the script by typing the string name at the command window to modify the script “fileex” to sum the numbers from the file and create a file in this format first.

Result:

MATLAB: A Practical Introduction to Programming and Problem Solving, Chapter 9, Problem 9.1P

Therefore, the script is saved and executed.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
edu/courses/106252/assignments/1102408?module_item_id=4856656 h Question 15 The numbers of false fire alarms were counted each month at a number of sites. The results are given in the following table. Month January February Number of False Alarms 45 41 March 25 April 26 May 45 June 32 July 43 August 40 September 34 October 25 November 33 39 December Click Download CSV to download csv file of data or copy/paste the data into Excel. After downloading the file, you may want to save it as an Excel Workbook. Test the hypothesis that false alarms are equally likely to occur in any month. Use 1% level of significance. Procedure: Select an answer What is the total count (that is, total number of false alarms counted): If false alarms are equally likely to occur in any month of 12 months, then what is the expected number of false alarms to occur in any month from the total false alarms of the year (Rounded to 3 or more decimal places): Assumptions: (select everything that applies) Normal…
A school administrator wants to see if there is a difference in the number of students per class for the Portland Public School district (Group 1) compared to the Beaverton School district (Group 2). Let μ be the average number of students per class for the Portland Public School district. Let 2 be the average number of students per class for the Beaverton School district. Assume the populations are normally distributed. A random sample of 25 Portland classes found a mean of 36 students per class with a standard deviation of 6. A random sample of 27 Beaverton classes found a mean of 38 students per class with a standard deviation of 5. a. Find a 91% confidence interval for the difference of the means. Use Excel Two Means Calculator found in the Course and round answers to 2 decimal places. <1-2 b. Select the correct conclusion based on the above confidence interval. O Since the above confidence interval contains zero, with 91% confident, it is plausible that the average number of…
Show all working as to how the answer was derived. 1. Currently, bank employees in the United States On less than $2,000/month. How would you set up a hypothesis test to corroborate this statement based on a given sample and confidence level? A. Ho: <2000 B. Ho: ≤2000 c. H₁: <2000 D. H₁: ≤2000 Assuming that the number of customer complaints follows a normal distribution, test the hypothesis that the average number of complaints is higher in the Mexican franchise (remember to first conduct a test for the equality of variances to find the statistic to use in the test of means). Use a significance level of 5% for your calculations. A. This is a left-tailed test where the test statistic t = -1.4558 allows us to reject Ho. B. This is a right-tailed test where the test statistic t = -1.4201 allows us to reject H. C. This is a left-tailed test where the test statistic t = -1.4558 does not allow us to reject Ho- D. This is a left-tailed test where the test statistic t = -1.4201 does not allow…
Knowledge Booster
Background pattern image
Statistics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, statistics and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Algebra: Structure And Method, Book 1
Algebra
ISBN:9780395977224
Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. Cole
Publisher:McDougal Littell
Text book image
PREALGEBRA
Algebra
ISBN:9781938168994
Author:OpenStax
Publisher:OpenStax
Text book image
Mathematics For Machine Technology
Advanced Math
ISBN:9781337798310
Author:Peterson, John.
Publisher:Cengage Learning,
Text book image
Holt Mcdougal Larson Pre-algebra: Student Edition...
Algebra
ISBN:9780547587776
Author:HOLT MCDOUGAL
Publisher:HOLT MCDOUGAL
Text book image
Trigonometry (MindTap Course List)
Trigonometry
ISBN:9781305652224
Author:Charles P. McKeague, Mark D. Turner
Publisher:Cengage Learning
Text book image
Elementary Algebra
Algebra
ISBN:9780998625713
Author:Lynn Marecek, MaryAnne Anthony-Smith
Publisher:OpenStax - Rice University
Whiteboard Math: The Basics of Factoring; Author: Whiteboard Math;https://www.youtube.com/watch?v=-VKAYqzRp4o;License: Standard YouTube License, CC-BY
Factorisation using Algebraic Identities | Algebra | Mathacademy; Author: Mathacademy;https://www.youtube.com/watch?v=BEp1PaU-qEw;License: Standard YouTube License, CC-BY
How To Factor Polynomials The Easy Way!; Author: The Organic Chemistry Tutor;https://www.youtube.com/watch?v=U6FndtdgpcA;License: Standard Youtube License