如何解决抽象函数在命令行中运行,而不在类中作为常量属性运行
以下功能在命令行上有效,但是在类中不能作为常量属性使用。我尝试了很多其他功能,例如集成其他功能等,但无法解决。 功能
enthalpyChange = @(constants,temperatureIn,temperatureOut)integral(@(temperature)...
F.heatCapacityOfLiquid(constants,temperature),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,temperatureOut)integral(@(temperature)...
F.heatCapacityOfLiquid(constants,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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。