MATLAB PROBLEM MOLAR MASS Problem10 Molar mass is the mass
MATLAB PROBLEM MOLAR MASS
% Problem{10}: Molar mass is the mass of one mole of an element or
% compound. The molar mass of a compound is given by the sum of the
% standard atomic mass of the atoms which form the compound multiplied by
% the molar mass constant, Mu = 1 g/mol. In organic chemistry, compunds
% known as alkanes are made exclusively of Carbon and Hydrogen, connected
% by single bonds. Therefore, given the resources below, where n is the
% number of carbons in the alkane, find the molar mass of the compound to
% two significant digits.
% Example: The molar mass of methane (CH4) is 16.04 g/mol.
% Note: http://en.wikipedia.org/wiki/Relative_atomic_mass,
% http://en.wikipedia.org/wiki/Alkane,
% http://en.wikipedia.org/wiki/List_of_straight-chain_alkanes
% Filename: Molar_Mass_Alkane.m
% Input: n
% Output: Molar_Mass
ANSWER:
n = 4;
Molar_Mass = (12*n) + ((1.01*(2*n)+2));
% Problem{07}: Using what you learned/wrote from Homework_03 - Problem{10}
% (Molar mass calculator), modify the script to report the molar mass for
% the first ten alkanes.
% Filename: molar_mass_alkane.m
% Input: n (1 x 10)
% Output: molar_mass (1 x 10)
Solution
For Problem-10:
n=input(\'Enter the number of carbons in alkane: \');
y=(12*n)+((1.01)*(2*n+2));
disp(y);
For Problem-07:
for n=1:10
y=(12*n)+((1.01)*(2*n+2));
disp(y);
end

