470 Chapter 15 MATLAB
TABLE 15.6 The Relationship between the Interest
Earned and the Amount Deposited
Dollar
Interest Rate
Amount 0.06 0.07 0.08
1000 60 70 80
1250 75 87.5 100
1500 90 105 120
1750 105 122.5 140
2000 120 140 160
2250 135 157.5 180
2500 150 175 200
2750 165 192.5 220
3000 180 210 240
TABLE 15.5 Examples of the MATLAB’s Matrix Operations
Example: A and B are
Matrices Which You
Operation Symbols or Commands Have Defined
Addition + AB
Subtraction - AB
Multiplication * A*B
Transpose matrix name¿ A¿
Inverse inv(matrix name) inv(A)
Determinant det(matrix name) det(A)
Eigenvalues eig(matrix name) eig(A)
Matrix left division \ See Example 15.5
(uses Gauss elimination
to solve a set of linear
equations)
Example 14.2 Using MATLAB, create a table that shows the relationship between the interest earned and the
(Revisited) amount deposited, as shown in Table 15.6.
To create a table that is similar to Table 15.6, we type the following commands.
>> format bank
>> Amount = 1000:250:3000;
>> Interest_Rate = 0.06:0.01:0.08;
>> Interest_Earned = (Amount')*(Interest_Rate);
>> fprintf('\n\n\t\t\t\t\t\t\t Interest
Rate');fprintf('\n\t Amount\t\t');...
fprintf('\t\t %g',Interest_Rate);fprintf('\n');
disp ([Amount',Interest_Earned])
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀