Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 抽象函数在命令行中工作,而不是作为常量属性在类中工作_Matlab_Anonymous Function_Matlab Class - Fatal编程技术网

Matlab 抽象函数在命令行中工作,而不是作为常量属性在类中工作

Matlab 抽象函数在命令行中工作,而不是作为常量属性在类中工作,matlab,anonymous-function,matlab-class,Matlab,Anonymous Function,Matlab Class,下面的函数在命令行中工作,但不是作为常量属性在类中工作。我尝试了很多不同的积分和其他函数的组合,但我无法解决它。 功能 enthalpyChange = @(constants, temperatureIn, temperatureOut)integral(@(temperature)... F.heatCapacityOfLiquid(constants,temperature), temperatureIn,temperatureOut); 课堂上 cla

下面的函数在命令行中工作,但不是作为常量属性在类中工作。我尝试了很多不同的积分和其他函数的组合,但我无法解决它。 功能

         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

这是不可复制的,在Matlab 2020b上调用
F.焓变化([1 2 3 4],25,60)
这能回答您的问题吗?因此,与前面的类似问题相比,您将一个函数移动为
静态
方法,但尝试将其他函数保持为
常量属性
。你在上一个问题中已经注意到它不起作用了,你又在问同样的问题。为什么您如此坚持要在
属性中执行此计算??顺便说一下,你说的是匿名函数,不是抽象函数。如果你说错话,你会把试图回答你问题的人弄糊涂。请检查大小写。这个问题与方法无关。在我的第一个线程中,我没有在命令行上测试它,如果您有时间检查的话,我也不确定它的语法,但是我想您没有(由于您的大小写错误)。您可以检查并看到它们不是同一个命令。