Error when trying to run a function

1 回表示 (過去 30 日間)
JEDIDI Ran
JEDIDI Ran 2020 年 6 月 4 日
コメント済み: David Hill 2020 年 6 月 4 日
i wrote that function alone in a file
function [g] = R(a,b,c,d)
rou=880;
Cd=0.7;
Aorifice=1.963495408*(10^(-5));
Vo=7*10^(-5);
Beta=1600*(10^5);
Ap=(5.026548246)*10^(-3);
g=(Beta/(Vo+b))*(sign(a-d)*Cd*Aorifice*sqrt(2*abs(a-d)/rou)-(Ap*c));
end
but when i run it i get that error "Not enough input arguments."
i don't find what missing here ?

回答 (1 件)

David Hill
David Hill 2020 年 6 月 4 日
function [g] = R(a,b,c,d)
rou=880;
Cd=0.7;
Aorifice=1.963495408*(10^(-5));
Vo=7*10^(-5);
Beta=1600*(10^5);
Ap=(5.026548246)*10^(-3);
g=(Beta/(Vo+b))*(sign(a-d)*Cd*Aorifice*sqrt(2*abs(a-d)/rou)-(Ap*c));
end
Nothing wrong there...how are you executing your function?
g=R(1,2,3,4);%need to provide 4 inputs.
  2 件のコメント
JEDIDI Ran
JEDIDI Ran 2020 年 6 月 4 日
i insered this function in another code and i get weird results, u're right the problem is not in this function
David Hill
David Hill 2020 年 6 月 4 日
If you do not provide any additional information, we cannot help you.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by