To find the molar mass of an object in matlab, we need to know its chemical formula and the atomic weight of each element present in it. We can use the following formula to calculate the molar mass:
main.m81 chars2 lines
Here's the code to calculate the molar mass of H2O (water) in matlab:
main.m346 chars14 lines
Output:
main.m39 chars2 lines
gistlibby LogSnag