Question: Using Matlab: What script can sum all the numbers from one to some arbitrary integer N by utilizing both a for loop and a while

Using Matlab:

  1. What script can sum all the numbers from one to some arbitrary integer N by utilizing both a for loop and a while loop. Then use these scripts to calculate the sum of the integers between one and fifty. Check your answer using the command sum(1:50)
  2. How can you write a scriptthatcansolve thiscompoundinterestproblem. Suppose that you have a $20,000 loan at 6 percent annual interest compounded monthly. You canafford to pay $200/monthtowardthisloan. How longwill ittake untiltheloanispaidoff? Hint: A While Loop will be useful. The loop will need to simultaneously keep track of how much you payeach year and how much the principle balance increases each year. The condition that stops the loopwill be when the amount paid is greater than the principle balance. The Compound Interest exampleabove will beuseful.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Physics Questions!