以下函数在命令行中起作用,但在类中不作为常量属性。我尝试了很多不同的组合与其他功能等,但我无法解决它。 功能
enthalpyChange = @(constants, temperatureIn, temperatureOut)integral(@(temperature)...
F.heatCapacityOfLiquid(constants,temperature), temperatureIn,temperatureOut);
在班上
classdef F
%FORMULAS Summary of this class goes here
% Detailed explanation goes here
properties (Constant)
%F.heatCapacityOfLiquid
t = @(z) z *2
end
properties (Constant)
enthalpyChange = @(constants, temperatureIn, temperatureOut)integral(@(temperature)...
F.heatCapacityOfLiquid(constants,temperature), temperatureIn,temperatureOut);
heatCapacityOfLiquid = @(constants, temperature) constants(1)...
+ temperature * constants(2)...
+ temperature.^2 * constants(3)...
+ temperature.^3 * constants(4);
% heatCapacityOfLiquid = @F.HeatCapacityOfLiquid
end
methods (Static)
function val = HeatCapacityOfLiquid(constants,temperature)
formula = @(constants, temperature) constants(1)...
+ temperature * constants(2)...
+ temperature.^2 * constants(3)...
+ temperature.^3 * constants(4);
val = formula(constants, temperature);
end
end
end