'problemset4pt1' requires more input arguments to run

1 次查看(过去 30 天)
Not sure how to fix. Here is the code:
function f_x = problemset4pt1(porosity)
% Constants
deltaP = 810.5; %dyn/cm^2
l = 20; %cm
mu = 0.01; %Poise
rho = 1; %gm/cm^3
dp = 0.1; %cm
u = 0.75; %cm/s
%Evaluating function
f_x = 150*mu*u/(dp^2)*((1-porosity)^2)/(porosity^3) + 1.75*rho*(u^2)/dp*(1-porosity)/(porosity^3) - deltaP/l;
end

回答(1 个)

Les Beckham
Les Beckham 2023-10-27
How are you calling the function? You can't just press the green Run triangle in the editor for a function that requires input arguments. Go to the command window and call the function with an appropriate value for the porosity input argument.
It seems to work fine here (at least it runs and returns a result).
result = problemset4pt1(0.1)
result = 9.9944e+04
function f_x = problemset4pt1(porosity)
% Constants
deltaP = 810.5; %dyn/cm^2
l = 20; %cm
mu = 0.01; %Poise
rho = 1; %gm/cm^3
dp = 0.1; %cm
u = 0.75; %cm/s
%Evaluating function
f_x = 150*mu*u/(dp^2)*((1-porosity)^2)/(porosity^3) + 1.75*rho*(u^2)/dp*(1-porosity)/(porosity^3) - deltaP/l;
end

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by