
MATLAB Word Problems for Practice
1. Bank Interest Calculation
A customer deposits 5 million UGX in a savings account that earns an 8% annual interest rate,
compounded monthly. Write a MATLAB script to calculate the total amount in the account after 5
years.
2. Traffic Light Simulation
A traffic light cycles through green (30s), yellow (5s), and red (60s). Write a MATLAB function that,
given a time t (in seconds), determines the current light color.
3. Population Growth
A town has a current population of 50,000 and is growing at a rate of 3% per year. Write a MATLAB
function to predict the population after 10 years. Modify the function to find out in which year the
population exceeds 100,000.
4. Stock Market Prediction
You are tracking the daily prices of a stock for 30 days. Generate a random 30 1 vector representing
stock prices. Find the day with the highest price and the average price over 30 days. Plot the stock
prices over time.
5. Loan Repayment Schedule
A person takes a loan of 15 million UGX at a 10% annual interest rate, to be paid over 3 years with
equal monthly payments. Write a MATLAB function to calculate the monthly payment. Display a
table showing the remaining balance after each month.
6. Heat Transfer in a Metal Rod
A 1-meter-long metal rod is heated at one end to 100 C, while the other end is at 0 C. Use the finite
difference method to model the temperature distribution along the rod. Plot the temperature profile.
7. Earthquake Magnitude Comparison
The Richter scale measures earthquake magnitude logarithmically. Write a MATLAB function that
takes two earthquake magnitudes M1 and M2 and computes how many times more energy the
larger earthquake releases than the smaller one using the formula: E1 / E2 = 10^((M1 - M2) * 1.5).
8. Rocket Launch Simulation
A rocket is launched with an initial velocity of 500 m/s at an angle of 60 . Write a MATLAB script to
compute the maximum height, range, and flight time. Plot the trajectory of the rocket.
9. Water Tank Level Monitoring