9th Day of training program was the last day of Module1 (MATLAB Basics). The starting of the day was by recapping all the topics covered in last Eight days.

Basically this day was dedicated for Hands on Sessions so the students can apply their MATLAB knowledge to solve various technical problems as well as their daily life problems.

I am sharing few of the problems with their solution to my readers.

**Prob1.**

The population in the United States after 1980 can be approximated by the following equation:

P(n)= 227e^{0.07n}

where n represents the number of years after 1980. Write a MATLAB Program that can Estimate the population in the United States for a given year.

**Sol:**

year= input(‘Enter the year to calculate population: \n’);

n= year-1980;

p= 227*exp(0.007*n);

fprintf(‘ The population in the year %d is %d \n’,year,p)

**Prob2.**

Write a MATLAB program that estimates your electricity bill, if the appliances with the kilowatt consumption are shown below in the Table and the cost per kilowatt-hour of usage charge by the power provider is Rs.5.

**Table 2.1**

__Electrical Power Consumption__

**Appliance Kilowatt**

Refrigirator 0.5 kW

Microwave Oven 1.0 kW

TV 0.2 kW

Washing Machine 0.5 kW

Iron 1.25 kW

Toaster 1.3 kW

AC 1.5 kW

**Sol:**

clc

clear

disp(‘Welcome to the utility for Electricity Bill Calculation \n’);

ref= input(‘Enter the uses of Refrigirator in hours per day: \n’);

micro= input(‘Enter the uses of Microwave oven in hours per day: \n’);

tv= input(‘How many hours you watch the TV per day: \n’);

wm= input(‘How many hours you use the Washing Machine per day: \n’);

iron= input(‘Enter the uses of Iron in hours per day: \n’);

tost= input(‘Enter the uses of Toster in hours per day: \n’);

ac= input(‘Enter the uses of Air Conditioner in hours per day: \n’);

in1= input(‘Enter the name of month for Billing:’,’s’);

in2= input(‘Enter the no. of days in current month:’);

total_KW=(ref*0.5+micro*1+tv*0.2+wm*0.5+iron*1.25+tost*1.3+ac*1.5)*in2;

bill= total_KW*5; fprintf(‘Your Electricity bill for the month %s is %f \n’,in1,bill);

**Prob3.**

Write a MATLAB program that returns the sequence consisting of square of the first 50 even numbers (0 4 16 36 64 100 … 9604), and identify and display the first, fifth, and tenth element of that sequence.

**Sol:**

clc

clear

n=1;

for ii= 2:2:100

sqr(n)=ii.^2;

if(n==1|n==5|n==10)

fprintf(‘The square of %d element is: %d \n’,n,sqr(n));

end n=n+1;

end