not enough argument input

5 ビュー (過去 30 日間)
Ronald Aono
Ronald Aono 2019 年 9 月 27 日
コメント済み: Ronald Aono 2019 年 9 月 27 日
function Td = dew_point(T,RH)
a = 17.27; b = 237.7;
f = (a.*T)/(b+T) + ln(RH/.100); Td = b.*f ./(a - f);
When i try to run the above code it gives an erorr of not enough argument input , My T and RH are both Vectors

採用された回答

Ronald Aono
Ronald Aono 2019 年 9 月 27 日
ok this is my other command window were the values of T and RH have been defined, but i still get the same error code
% the dew point T & RH values
T = [20 25 30 35]; RH = (30:10:100);
Td = Dew_point(T,RH);
Not enough input arguments.
Error in Dew_point (line 7)
f = (a.*T)./(b+T) + log(RH/.100); Td = b.*f ./(a - f);

その他の回答 (1 件)

James Tursa
James Tursa 2019 年 9 月 27 日
編集済み: James Tursa 2019 年 9 月 27 日
You need to put your function code into a file called dew_point.m
Then you need to call your function with inputs, e.g.
T = something
RH = something
Td = dew_point(T,RH);
Also, since T and RH can be vectors, I am assuming you want the element-wise divide operator and not the matrix divide operator:
f = (a.*T) ./ (b+T) + ln(RH/.100);
In the line above, is that really supposed to be RH/.100 as you typed it, or should it be RH / 100 ?
Note that if you push the "green run" button in the editor, it runs the code without any inputs.
  4 件のコメント
James Tursa
James Tursa 2019 年 9 月 27 日
編集済み: James Tursa 2019 年 9 月 27 日
You have your function code in a separate file named dew_point.m, and that is the only code in that file? And that is the only place where this function code appears? And you call the code from the command line with the three lines I show?
And, you realize that RH/.100 is interpreted as RH / 0.100, right? It is not RH divided by 100, it is RH divided by one-tenth. I still suspect you meant RH ./ 100, but since 100 is a scalar you can simply use RH / 100 and get the same result.
Are T and RH different sizes? Your current code is only set up to handle them if they are the same size.
Ronald Aono
Ronald Aono 2019 年 9 月 27 日
this is my other window where the values of T and Rh have been defined, but i still get the same error code
% the dew point T & RH values
T = [20 25 30 35]; RH = (30:10:100);
Td = Dew_point(T,RH);
Not enough input arguments.
Error in Dew_point (line 7)
f = (a.*T)./(b+T) + log(RH/.100); Td = b.*f ./(a - f);

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

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by