Hi please help I can't run my code it says not enough input arguments line 3

1 次查看(过去 30 天)
% (i) pipe_velocity(): calculating the water velocity v (m/s) of a given pipe diameter d (mm) and flow rate Q (/s).
function v = pipe_velocity(d, Q)
A = pi * (d / 1000)^2 / 4; % Cross-sectional area (m^2)
v = Q / A; % Velocity (m/s)
end

回答(1 个)

Dongyue
Dongyue 2023-5-23
res = pipe_velocity(1,2)
res = 2.5465e+06
function v = pipe_velocity(d, Q)
A = pi * (d / 1000)^2 / 4; % Cross-sectional area (m^2)
v = Q / A; % Velocity (m/s)
end
You may have to call the function after defining it.
You can go through the documentaton for MATLAB Function or Anonymous Function for more instructions:

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by