Function requires more inputs
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi! I am trying to work the following code, but it keeps saying that I need more inputs:
function r = rxnrate(F)
global k Keq
Fa=F(1);
Fb=F(2);
Fc=F(3);
Fd=F(4);
f=33.3;
P=1;
Pa=(Fa/f)*P;
Pb=(Fb/f)*P;
Pc=(Fc/f)*P;
Pd=(Fd/f)*P;
r(1)=k*((Pa*Pb)-(Pc*Pd/Keq));
r(2)=k*((Pa*Pb)-(Pc*Pd/Keq));
r(3)=k*((Pa*Pb)-(Pc*Pd/Keq));
r(4)=k*((Pa*Pb)-(Pc*Pd/Keq));
r=r';
end
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 5월 26일
To run that code, you need to have first executed some code that used
global k Keq
and then assigned values to k and Keq.
That having been done once, you need to invoke the routine passing in data, such as
ftest = randn(1,4);
result = rxnrate(ftest);
It is not possible to invoke the code by simply typing the name of the function, or by simply pressing the green Run button while you are in the editor on this function. Even if you have defined F in your current workspace, MATLAB will not look for an F in the hierarchy if you try to invoke rxnrate without passing in anything.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!