Not enough input arguments

i want to calculate rpm when two values approximately the same TT and T
this is the code
function rpm =zzzzzz(modelspeed,modelresistance,propellerdiameter,density,wakefraction,thrustdeduction)
va=modelspeed*(1-wakefraction);
for rpm=100:2000;
T=modelresistance/(1-thrustdeduction);
j=va/((rpm./60)*propellerdiameter);
kt=0.37159*(1-(j/0.955))^0.8;
TT=kt*density*(rpm./60)^2*propellerdiameter^4;
kq=0.0476*(1-(j/1.0064))^0.7;
q=kq*density*(rpm./60)^2*propellerdiameter^5;
if TT(rpm)/T>0.999 %when T~T’%
rpm
return
end
end
when i run this code i receive an error message ' Not enough input arguments.' for the line of this equation
va=modelspeed*(1-wakefraction);
Best Regards, Ameen

2 commentaires

Angus
Angus le 21 Juin 2013
what are modelspeed and wakefraction?
Angus
Angus le 21 Juin 2013
really not sure if it could be causing any problems but I would encourage you to not use the name of your function as a variable inside the function. Rather
function rpm_calc = zzzzzz(...)
...
for rpm = 100:200;
...
if TT(rpm)/T>0.999
rpm_calc = rpm;
return
...
Not sure if using rpm inside the function is somehow trying to call the function again?

Réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 21 Juin 2013

0 votes

zzzzzz is not a script it's a function, and should be called like below
out=zzzzzz(modelspeed,modelresistance,propellerdiameter,density,wakefraction,thrustdeduction)

5 commentaires

ameen
ameen le 21 Juin 2013
when i used out=zzzzzz(modelspeed,modelresistance,propellerdiameter,density,wakefraction,thrustdeduction)
it give me error the line you gave me
Error in z (line 1) out = zzzzzz(modelspeed,modelresistance,propellerdiameter,density,wakefraction,thrustdeduction)
Azzi Abdelmalek
Azzi Abdelmalek le 21 Juin 2013
before calling zzzzz you should assign values to modelspeed,modelresistance,...
ameen
ameen le 21 Juin 2013
i gave every variable its value in Matlab before runing the code
Azzi Abdelmalek
Azzi Abdelmalek le 21 Juin 2013
Is the error message the same?
ameen
ameen le 21 Juin 2013
yes
Matt Tearle
Matt Tearle le 21 Juin 2013

0 votes

The error message you're getting seems to indicate a problem with how you're calling the function, rather than the function itself. I copied the function exactly as you have it, then did this:
>> zzzzzz(1,2,3,4,5,6)
And I got a different error message, related to line 10 ( if TT(rpm)/T>0.999 ).
Call the function just as I did. If you get the same error message as before, you might need to do
which zzzzzz
to figure out which function/variable MATLAB is actually finding (because it must be a different one).
Now, there are other issues with the function -- pay attention to the Code Analyzer messages you get in the Editor. I think this is what you're trying to do:
function rpm =zzzzzz(modelspeed,modelresistance,propellerdiameter,density,wakefraction,thrustdeduction)
va=modelspeed*(1-wakefraction);
for rpm=100:2000;
T=modelresistance/(1-thrustdeduction);
j=va/((rpm./60)*propellerdiameter);
kt=0.37159*(1-(j/0.955))^0.8;
TT=kt*density*(rpm./60)^2*propellerdiameter^4;
if TT/T>0.999 %when T~T’%
return
end
end
There are prettier ways to do it, but that should work.

Cette question est clôturée.

Question posée :

le 21 Juin 2013

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by