我真的不知道如何编码,我需要更改它,以包含一个输入来要求给定的长度。这是我当前的代码:
tank_Volume(2.75, 3.0, 62.3)
% b is base length in feet, h is height in feet
%p is rho in lb/ft^3
%volume in ft^3, m is mass in lb
function [m] = tank_Volume(b, h, p)
v = (b * h)/3;
m = p * v;
end
如果你只是想要一个前端用户界面,你可以使用input((函数:
b = input('Enter base length in feet ');
h = input('Enter height in feet ');
p = input('Enter rho in lb/ft^3 ');
m = tank_Volume(b,h,p);