Question: Use MATLAB Problem 1 Solve this problem using two separate scripts: in the first, use a for loop; in the second, use a while loop.
Use MATLAB
Problem 1


Solve this problem using two separate scripts: in the first, use a for loop; in the second, use a while loop. In the first program, you will need to use the break command to break out of the for loop. A car value depreciates at a rate of 5% per year. i.e., if the value of the car in year n is Vn, then the value in the next year is Vn+1- Vn-0.05Vn. Determine the number of years required for a $20,000 car to depreciate to $4,000 or less. Note: the answer is NOT 4 years. Express your answer as an integer number of years (no fractional years). Display the number of years and the value of the car at the end of that year. Hint: Set V(1) 20000, the value of the car at the beginning of year 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
