MATLAB: “Function might be unused”

function

I can't seem to figure our why Matlab doesn't like my function. It keeps telling me that it is probably called incorrectly but I can't see what I did wrong here.
Ideal Boiler Function
hfg=930
lhv=21500
p_percent=100
p=p_percent/100
MFfr=0.5191
%This function will calculate the steam mass flow rate (SMfr)
%of an actual boiler with 100% efficency (p_percent=100%)
%This funtion has 4 inputs (p,hfg,lhv,and MFfr),
%and 1 output (SMfr).
function SMfr=Ideal_Boiler(p,hfg,lhv,MFfr)
SMfr=(MFfr*p*lhv)/hfg;
output=SMfr;
end
disp('SMfr =');disp(SMfr)

Best Answer

I don't see any problems, unless you defined the function inside your main script, and MATLAB doesn't allow that.
hfg=930;
lhv=21500;
p_percent=100;
p=p_percent/100;
MFfr=0.5191;
SMfr=Ideal_Boiler(p,hfg,lhv,MFfr)
disp('SMfr =');disp(SMfr)
SMfr =
12.0007
SMfr =
12.0007
Related Question