フィルターのクリア

Error using log Not enough input arguments. This is the error message I keep getting. Pls help

2 ビュー (過去 30 日間)
%Write a .m script file that defines these two functions as anonymous functions and then plots
%boiling temperature against altitude in the range from ’500 ft to 14,439 ft (Colorados highest point).
clear all
h = linspace(-500, 14439, 1000);
p = @(h) 29.92 * (1 - 6.8753 * 10 .^(-6) * h);
p(h)
T = @(p) 49.161 .* log.*(p)+ 44.932;
T(p);
fplot(p,T);

回答 (2 件)

Chunru
Chunru 2021 年 9 月 1 日
Don't confuse the function handle with numerical variables.
h = linspace(-500, 14439, 1000);
p = @(h) 29.92 * (1 - 6.8753 * 10 .^(-6) * h);
ph = p(h);
T = @(p) 49.161 .* log(p) + 44.932;
Tp = T(ph);
plot(ph,Tp);

Walter Roberson
Walter Roberson 2021 年 9 月 1 日
T = @(p) 49.161 .* log.*(p)+ 44.932;
^^^^^^^^
That means that the code should attempt to invoke the function named log with no parameters, and multiply the result returned by log by the value of p. Unless you do some unusual assignments higher in the code, that line of code is the same as if you had written
T = @(p) 49.161 .* log().*(p)+ 44.932;

カテゴリ

Help Center および File ExchangeSemiconductors and Converters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by