Question: In this homework problem, and in all subsequent homework problems, you will partition your script m-file into sections. There will be one section per problem.

In this homework problem, and in all subsequent homework problems, you will partition your script m-file into sections. There will be one section per problem. Because Homework 1 has two problems, your script m-file for this homework will contain 2 sections. Have MATLAB print (to the command window) the following: e in fixed-point notation to seven decimal places (plus a new line) e in exponential (scientific) notation with five decimal places (plus a new line) -256 in (signed) integer notation (plus a new line) In the above, e is the base of the natural logarithm. MATLAB will generate this number whenever you ask for this: exp (1). With this statement, you are asking for e You will use fprintf. You should first read the MATLAB documentation on the function fprintf. Pay particular attention to the forma portion of the documentation. (On the fprintf documentation page, click on the format hyperlink.) In this problem you won't be printing to a file, so you won't supply the optional fileID input. If you are familiar with the CC++ function printf, you will sce that the MATLAB fprintf function works in a similar way. The purpose of this assignment is for you to practice formatted printing of numbers. You are asked not to print pure literal strings. For example, don't do this: fprintf 2.7182818 n' Don't do this! It is true that this statement will produce the desired first line. However, you will not learn the formatted printing of numbers if you do this. Instead, you will ask MATLAB to print exp (1) using a total of 9 characters, 7 of which will be to the right of the decimal place. (There will also be I character to the left of the decimal place and the decimal point, making a total of9 characters) Use the function sum to do this problem. First, create the following matrix: [1 4 7 2 5 8 3 6 9]. From this matrix, create a row vector, each element of which is the sum of the elements in one column of the above matrix. For example, the first element in this vector should be12. Display this row vector. From this matrix, create a column vector, each element of which is the sum of the elements in one row of the above matrix. For example, the first element in this vector should be 6. Display this column vector. Calculate the sum of all elements in the matrix above and display this sum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
