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
Yea uh... mmmmm... may someone help me with this. Thank you so very much! :D
kobusy [5.1K]
What’s the question?
5 0
3 years ago
What is 1/8 of 3?<br> What is 3 groups of 1/8?<br> How many 3's are in 1/8?
zimovet [89]

Answer:

0.375 is 1/8 of 3. 3 groups of 1/8 is 3/8. 0 3's are in 1/8.

Step-by-step explanation:

8 0
3 years ago
Given the function f(x) = | -2x + 4 |. Complete the table.
Finger [1]

Answer:

See below.

Step-by-step explanation:

To complete the table, start by copying the given function.

f(x) = |-2x + 4|

Now let's start with the first line of the table: x = 6.

You are finding the value of function f when x = 6.

Replace x with 6 and evaluate the expression.

f(6) = |-2(6) + 4|

f(6) = |-12 + 4|

f(6) = |-8|

f(6) = 8

Second line of table:

x = -1

f(x) = |-2x + 4|

f(-1) = |-2(-1) + 4|

f(-1) = |2 + 4|

f(-1) = |6|

f(-1) = 6

For the third and fourth lines, you are given a y value, or the value of function f, and you are looking for x. Now you use the given value to set the function equal to, and you solve for x.

Line 3: f(x) = 4

f(x) = |-2x + 4|

|-2x + 4| = 4

-2x + 4 = 4   or   -2x + 4 = -4

-2x = 0   or   -2x = -8

x = 0    or   x = 4

Line 4: f(x) = 14

f(x) = |-2x + 4|

|-2x + 4| = 14

-2x + 4 = 14   or   -2x + 4 = -14

-2x = 10   or   -2x = -18

x = -5    or   x = 9

The table looks like this:

x          f(x)

6         8

-1         6

0,4      4

-5, 9     14

\end{center}

6 0
3 years ago
What is the domain of the function F(x)=2cos(3x-1)
inna [77]

Answer:

\large{ x\in\mathbb{R}}

Step-by-step explanation:

Domain of a cosine is all real numbers.

Therefore the domain of F(x) = 2cos(3x - 1) is the set of all real numbers.

3 0
3 years ago
PLEASE HELP WILL BRAINLIST (one problem)
bearhunter [10]

Answer:

(-4,0) and (2,-6)

Step-by-step explanation:

Solve by graphing

7 0
3 years ago
Other questions:
  • N a hearing test, subjects estimate the loudness (in decibels) of a sound, and the results are: 68, 67, 70, 71, 68, 75, 68, 62,
    14·1 answer
  • Given the equation 2x2 - 5x + 7 = 0. Find the discriminant. Describe the roots and explain your reasoning.
    13·1 answer
  • 3 a plus b equals 54, when b equals 9?
    8·2 answers
  • Helpp please thank you
    7·1 answer
  • Please help me with my work
    13·1 answer
  • Solve the inequality for y.
    12·2 answers
  • PLS HELP WILL MARK BRAINLIEST The average of eight consecutive odd integers is 48. What is the range of these eight numbers?
    7·1 answer
  • Could someone help with this math question please brainlest and points
    10·1 answer
  • What is the correct factored form of the following polynomial:
    5·1 answer
  • Please help me with both problems thank you so much!!
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!