Error when trying to run a function

2 Ansichten (letzte 30 Tage)
JEDIDI Ran
JEDIDI Ran am 4 Jun. 2020
Kommentiert: David Hill am 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 ?

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by