1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mr Goodwill [35]
3 years ago
10

Program: assign03a.m Write a MATLAB script file that uses principal (or amount), rate of interest, and time to compute and displ

ay the simple interest with appropriate labeling. Create a vector of rates using the following information entered from user. Ask the user to enter the low and high values for the rate range and the number of rates. Ask the user for the number of years.

Mathematics
1 answer:
DochEvi [55]3 years ago
4 0

Answer:

The code is given in the answer along with the algorithm and explanation. The output and the workspace variables are also attached as screen shots.

Step-by-step explanation:

The basic algorithm of the code is as follows:

  1. Clear the workspace, command window and prepare the format as banking.
  2. Set the constant value of principal amount, this is fixed as 4000 in the code and can be changed.
  3. Ask the user to enter the value of lowest interest rate , highest interest rate , number of interest rate  values and number of years.
  4. Create the interest rate vector.
  5. For each entry of the interest rate vector, calculate the interest.
  6. Display the each entry of interest rate and the simple calculated interest.
  7. Calculate the average rate of interest and the average interest and display them.

The code is here as follows

%% Preparing the formats

clc,clear all;%Clearing command line and workspace

format bank%Formatting

format compact%Formatting

%% Setting the constants

PRINCIPAL = 4000;%Principal amount fixed as 4000.

%% Taking inputs from the user

low_val = input('Enter the low value for the rate range: ');%Lowest value of the interest

high_val = input('Enter the high value for the rate range: ');%Highest value of the interest

rate_vals = input('Enter the number of rate values including high and low values: '); %Total number of rate values

year = input('Enter number of years: ');% Number of years

%% Creating the interest vectors

rate = linspace(low_val,high_val,rate_vals);%Creating the vector

%% Initializing the array

simple_interest=zeros(length(rate),1);%initializing the array to hold the simple interest

%% Displaying the interest rate vectors

fprintf('\t\t Rate(%%)\t\tInterest($)\n');%Displaying the  interest rate and interest heading

%% Calculating the interest vectors

for i = 1:length(rate)

   simple_interest(i) = (rate(i)*year*PRINCIPAL)/100;%Calculating Simple rate of interest for a given rate over the principal amount

fprintf('\t\t %.2f\t\t\t%.2f\n',rate(i),simple_interest(i));% Displaying each entry  interest rate and interest

end

%% Calculating and printing the average interest

fprintf('Average: Rate(%%)\t\tInterest($)\n');%Displaying the heading for average rate and interest

fprintf('\t\t %.2f\t\t\t%.2f\n',mean(rate),mean(simple_interest));%Calculating and displaying the average interest.

You might be interested in
jasmine took four 20 points quizzes in her math class. if her scores were,18,15,20,15, what was her mean quiz score
g100num [7]

Answer: 17

Step-by-step explanation: ok so first to find the mean you add all the numbers then divide by how many numbers there is so basically 18 plus 15 plus 20 plus 15 then divide by 4 because there is 4 numbers and once you do that it is 17

3 0
3 years ago
Read 2 more answers
On average,Shane drinks 1/2 of a 6-ounce of water in 2/3 hour.How much water does she drinks in an hour.Show work
In-s [12.5K]

Answer:

4.5 ounces

Step-by-step explanation:

First dived 3 by 2 to figure out how much water she drinks in 1/3 of a hour.  

Second, you take the answer 1.5 ounces per 13 of an hour and multiply it by 3.

Lastly, you get your answer 4.5 ounces of water in a hour.

1. 3 / 2 = 1.5

2. 1.5 x 3 = 4.5

7 0
3 years ago
Read 2 more answers
HELP HELP HELP HELP help help
SVETLANKA909090 [29]

Answer:

r  = 6

Step-by-step explanation:

To get the value of r we will use the pythagoras theorem a shown;

PR² = QR² + PQ²

(4+r)² = 8² + r²

Expand

16+8r+r² = 64 + r²

16 + 8r = 64

8r = 64 - 16

8r = 48

r = 48/8

r = 6

Hence the value of r is 6

7 0
3 years ago
Write and graph exponential decay function
Anna71 [15]
P
pp is an exponential function with an initial value of
6 0
3 years ago
Can someone plz help me on 4-6
Anna [14]
The answer to 4-6 is negative 2
3 0
3 years ago
Other questions:
  • Use the number line to determine the absolute value. Enter the value, as a mixed number in simplest form, in the box. ∣∣−2 2/3∣
    8·1 answer
  • What term best describes the set of all points in a plane for which the sum of the distances to two fixed points equals a certai
    7·2 answers
  • Can anyone please help i am stuck on this question?
    10·1 answer
  • a coffee shop sells coffee beans by the pound. A container hold 16 kilograms of coffee beans. For every 1 kilogram, there are ap
    10·1 answer
  • Megan has a $1025.00 in a savings account see you're in simple interest of 5% per year how much interest will she​
    12·2 answers
  • Choose a system of equations with the same solution as the following system:
    15·2 answers
  • Sally pays her car insurance monthly. Her annual premium is $1024. Each payment she is charged a $5 convenience fee. If her annu
    7·1 answer
  • 21 plus 22 plus 9 plus 10 times zero
    7·2 answers
  • Help guys with this question
    14·2 answers
  • 6(8f+10g) + 9g - 4(3g+9f)
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!