User defined functions problem

3 ビュー (過去 30 日間)
Leora
Leora 2013 年 11 月 27 日
編集済み: Walter Roberson 2013 年 11 月 27 日
Create a function m-file called Chemistry.
Benzene,molecular weight=78.115 g/mol
Ethyl alcohol, mol.weight=46.07 g/mol
Tetrafluoroethane, mol.weight=102.3g/mol
mass=number of moles * mol.weight
The function Chemistry requires 2 vector inputs ie number of moles and mol.weight and returns the corresponding mass. It will be necessary to use meshgrid in the calculations
Test the function with the compounds listed in the above table for values of n (number of moles) from 1 to 10.
I am not sure of how to go about this, any help would be appreciated. Thank you!

回答 (1 件)

Image Analyst
Image Analyst 2013 年 11 月 27 日
I don't know what the sentence starting "Benzene....." is supposed to be. You forgot to say. Care to explain? And you already gave the function, pretty much
function mass = Chemistry(number_of_moles, mol_weight)
mass=number_of_moles * mol_weight;
  1 件のコメント
Leora
Leora 2013 年 11 月 27 日
The compounds are just a table of compounds and their molecular weights. The last part of the question uses it, thanks for your help

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeChemistry についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by