Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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 - Fatal编程技术网

Matlab 如何从现有函数中组装新函数?

Matlab 如何从现有函数中组装新函数?,matlab,Matlab,我有一个函数kappa,它包含另外两个函数sigma和sigma。 我得到的错误是 error: binary operator '.^' not implemented for 'function handle' by 'scalar' operations error: called from at line -1 column -1 我的代码是 >> syms epsilon >> a = 0.36990 >> b = 2.6474 >>

我有一个函数kappa,它包含另外两个函数sigma和sigma。 我得到的错误是

error: binary operator '.^' not implemented for 'function handle' by 'scalar' operations
error: called from
at line -1 column -1
我的代码是

>> syms epsilon
>> a =  0.36990
>> b =  2.6474
>> sigma = @(epsilon) 10 .^ (a * log (epsilon) + b)
>> sigma_=@(epsilon) diff(sigma)
>> sigma__=@(epsilon) diff(sigma_)
>> kappa=@(epsilon) (sigma__)/(1+sigma_.^2).^(3/2)

>> kappa(1)
error: binary operator '.^' not implemented for 'function handle' by'scalar' operations
error: called from
at line -1 column -1
我编辑了我的代码:

>> sigma_ = @(epsilon) diff (sigma (epsilon))
>> sigma__=@(epsilon) diff(sigma_(epsilon))
>> sigma_(1)
ans = [](0x0)
>> kappa=@(epsilon) (sigma__(epsilon))/(1+sigma_(epsilon).^2).^(3/2)
>> kappa(1)
ans = [](0x0)

忽略令人困惑的函数命名,每个
sigma*
函数都有一个参数,但您不会将参数传递给它们中的任何一个。尝试
sigma(epsilon)
(在4个不同的地方)。谢谢你的回答。我编辑了我的代码,但现在它返回一个空的setYes,因为标量值的
diff
为null。我找到了答案-我使用了运算符。