project matlab
DESCRIPTION
matlabTRANSCRIPT
A. Problem 1
This program was designed to covert the angles from degrees to radians as well as to find their respective sine and cosines of the angles. INPUTPROCESSINGOUTPUT
DegreesGET degreesDegrees
radians = degrees*pi/180
Radians
Calculate the sine of the angle( radians)Sine
Calculate the cosine of the angle(radians)Cosine
INPUT PROCESS OUTPUT CHART FOR PROBLEM 1
Pseudocode
GET degreesINCREASE degrees by increments of 30COMPUTE the angle in radians (rad) by dividing the product of the angle in degree and pi by 180DETERMINE the sine of the angles in radiansDETERMINE the cosine of the angles in radiansDISPLAY Degrees, radians, sine and cosine.
Results
% This program generates a table of conversions from degrees to radians% and calculates their respective sine and cosine functions%deg = 0:30:360;rad = deg*pi/180;a = sin(rad);b = cos(rad);%table(:,1) = deg';table(:,2) = rad';table(:,3) = a';table(:,4) = b';%disp(table) 0 0 0 1.0000 30.0000 0.5236 0.5000 0.8660 60.0000 1.0472 0.8660 0.5000 90.0000 1.5708 1.0000 0.0000 120.0000 2.0944 0.8660 -0.5000 150.0000 2.6180 0.5000 -0.8660 180.0000 3.1416 0.0000 -1.0000 210.0000 3.6652 -0.5000 -0.8660 240.0000 4.1888 -0.8660 -0.5000 270.0000 4.7124 -1.0000 -0.0000 300.0000 5.2360 -0.8660 0.5000 330.0000 5.7596 -0.5000 0.8660 360.0000 6.2832 -0.0000 1.0000SCREENSHOT OF THE PROGRAM 1 BEFORE AND AFTER EXECUTION
Problem 2
This program was developed to determine the death of a creature utilizing the carbon 14 content for that creature.
INPUTPROCESSINGOUTPUT
Initial_amount of Carbon 14GET initial_ amount and Remainder
Remainder
CALCULATE n as equal to (log (remainder/initial_amount)) divided by (log (1/2));
PRINT USELESS
CALCULATE age as the product of n and the half-life of carbon 14 (5730)
IF n is more than one THEN
INPUT PROCESS OUTPUT CHART FOR PROBLEM 2
Pseudocode
SET initial amount of carbon 14 to one hundred percentPRINT Enter the percentage of the remaining carbon 14 from the creatureREAD remainderCALCULATE n as equal to (log (remainder/initial_amount)) divided by (log (1/2));CALCULATE age as the product of n and the half-life of carbon 14 (5730)IF n is more than one THENPRINT USELESSELSEPRINT MATCH_FOUNDENDIF
Results
>> % This program calculates the death of a creature.%initial_amount = 100;remainder = input('Enter percentage of remaining carbon 14 on the : ');n = (log(remainder/initial_amount)) / (log(1/2));age = n*5730%if n > 1 fprintf('USELESS')else fprintf('MATCH_FOUND')endEnter percentage of remaining carbon 14: 60
age =
4.2228e+03
'MATCH_FOUND'>>
SCREENSHOT OF THE PROGRAM 2 BEFORE EXECUTION
SCREENSHOT OF THE PROGRAM 2 AFTER EXECUTION
Problem 3
This program was designed to determine the estimated number of years it would take for the population of Jamhram City to surpass twenty million people and the citys estimated population at the end of this time.INPUTPROCESSINGOUTPUT
PopulationREAD Population of Jamhram city, Rate of the population growth, Number of yearsThe number of years for this population to grow pass twenty million.
Rate Population of the city
Yearwhile population < = 20000000 do
growth = population*exp^(rate*year)
population = population + growth
year = year + 1
Display year years required
INPUT PROCESS OUTPUT CHART FOR PROBLEM 3PSEUDOCODE
SET Population equal to 50,000SET rate equal to 0.00000000112SET the year number of years equal to zeroWHILE the population is less than or equal to twenty million DO Population is equal to the sum of the population and growthIncrement yearENDWHILE DISPLAY years required is , year DISPLAY The population of the city is , populationEND
RESULTS
>> %This program calculates the population growth of Jamhram city.%population = 50000;rate = 0.000000001112;year = 0;%while population