'problemset4pt1' requires more input arguments to run

1 vue (au cours des 30 derniers jours)
Caleb
Caleb le 26 Oct 2023
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

Réponses (1)

Les Beckham
Les Beckham le 27 Oct 2023
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

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by