Error when trying to run a function

1 view (last 30 days)
JEDIDI Ran
JEDIDI Ran on 4 Jun 2020
Commented: David Hill on 4 Jun 2020
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 ?

Answers (1)

David Hill
David Hill on 4 Jun 2020
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 Comments
JEDIDI Ran
JEDIDI Ran on 4 Jun 2020
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 on 4 Jun 2020
If you do not provide any additional information, we cannot help you.

Sign in to comment.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!