Project #18469 - Matlab

Using Matlab

Problem 1:

In hw2.m write a while to solve the following problem:

Starting on his 25th birthday, Jerome deposits $5000 at the beginning
of every year into a retirement annuity that pays 7% interest per year
compounded annually. He wants to retire when his annuity first reaches
(or exceeds) $1,000,000. In how many years will he be able to retire
with this savings plan?   Make sure to display your final answer to
the user.

Problem 2:

A meteorologist collects temperature data every day for the past few
years. Here is an example of his data for a month of June, where each
individual values reflects the highest temperature on a particular


The meteorologist needs to know when heat waves occur. He defines heat
waves as periods of time where the maximum temperature exceeds 90
degrees Fahrenheit for more than 7 continuous days.  Create a
function, heat_wave (in the file heat_wave.m), that utilizes a while
loop to count how many heat wave events occur in addition to the total
number of days that were part of a heat wave. This function should
take in a 1-by-n matrix, D, of temperature data (where n can be any
positive integer) as its input.  The function should output a two
element matrix, were the first element reflects the number of heat
wave events that occurred within the data set and the second the
number of total days that were part of any heat wave.

In hw3.m create the matrix of temperartures listed above and then run
the heat_wave function on that matrix.

Note: in the example month of June there is only one heat wave since
the days where the temperature reaches at least 90 degrees Fahrenheit
are all connected.

Problem 3:

From within hw3.m, write a while loop that that Prompts the user to
enter numeric grades (one at a time) within a while loop. Any number
of grades can be entered. The user should enter a negative number to
indicate that there are no more grades.

Write code in hw3.m to determine and display how many grades fall
within each grade range - A (90 or higher), B (80-90), C (70-80), D
(60-70) and F (0-60).

Problem 4:

Write a function, my_factorial (in the file my_factorial.m), that uses
a for loop to calculate and output  y = n! where the input is a
positive integer, n.

Within hw3.m test your factorial function on a few inputs.

Problem 5:

Write a function called my_search (in a file called my_search.m).  The
function will take two input arguments, an array, and a value k.
Within the function, use a for loop to iterate through each element of
the array.  Compare each element to k and have the function return the
last location in the array at which the value k appears.

Test your my_search.m function on a sample array and k from within the
hw3.m script.

What you need to submit:

After you have successfully completed this assignment you will have a
number of files:


 Create a zip file containing a number of files.

Subject Computer
Due By (Pacific Time) 12/06/2013 09:00 pm
Report DMCA

Chat Now!

out of 1971 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 1164 reviews

Chat Now!

out of 721 reviews

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 680 reviews
All Rights Reserved. Copyright by - Copyright Policy