'problemset4pt1' requires more input arguments to run

조회 수: 1 (최근 30일)
Caleb
Caleb 2023년 10월 26일
답변: Les Beckham 2023년 10월 27일
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

카테고리

Help CenterFile Exchange에서 Converters (High Power)에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by