Function requires more inputs
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 26 de Mayo de 2018
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 comentarios
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!