Reputation: 13
Following function works at the command line, however not in the class as a constant property. I tried a lot of different combination with integral other function etc. but I was unable to solve it. Function
enthalpyChange = @(constants, temperatureIn, temperatureOut)integral(@(temperature)...
F.heatCapacityOfLiquid(constants,temperature), temperatureIn,temperatureOut);
In Class
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
Upvotes: 0
Views: 33