Why I got the error "Undefined operator '.*' for input arguments of type 'function_handle"?

6 ビュー (過去 30 日間)
RCac = @(~,state) (-k4.*(state.u(1)./K3+state.u(1)).^2+...
k3.*state.u(1)./(KCICR+state.u).*(IP3./(IP3+K2)).^3.*Cas)...
-kon.*state.u(1).*(BT-CaB)+koff.*CaB;
s = @(x, y) RCac;
Fe = wOmega(1) * PhiIPS(:, 1) .* s(ip(1, 1), ip(1, 2)) * areaOfElement + ...
wOmega(2) * PhiIPS(:, 2) .* s(ip(2, 1), ip(2, 2)) * areaOfElement + ...
wOmega(3) * PhiIPS(:, 3) .* s(ip(3, 1), ip(3, 2)) * areaOfElement;
I keep receiving the error message:
'function_handle' 型の入力引数の演算子 '.*' が未定義です。
エラー: BarbeeModel (line 159)
Fe = wOmega(1) * PhiIPS(:, 1) .* s(ip(1, 1), ip(1, 2)) * areaOfElement + ...
in English:
Undefined operator '.*' for input arguments of type 'function_handle'.
Error in
Fe = wOmega(1) * PhiIPS(:, 1) .* s(ip(1, 1), ip(1, 2)) * areaOfElement + ...

採用された回答

Steven Lord
Steven Lord 2020 年 1 月 19 日
You can't multiply a function handle, which is what s returns. If you intend s to evaluate the function handle RCac, just make it an alias of that function handle.
s = RCac;
Or if you wanted to make it explicit in that line of code that s is a function handle:
s = @(x, y) RCac(x, y);
In either of these cases s(something, somethingElse) returns a number rather than a function handle, and you can multiply a number by another number.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics and Visualization についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by