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 CenterFile Exchange 中查找有关 Semiconductors and Converters 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by