User defined functions problem
조회 수: 2 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
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;
I don't see at all how meshgrid is supposed to be involved in that. Seems like you need to read these links: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer and http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!