フィルターのクリア

Defining anonymous with other anonymous functions.

1 回表示 (過去 30 日間)
David
David 2013 年 10 月 30 日
コメント済み: David 2013 年 10 月 30 日
Could somebody tell me why the following code returns the following error?? 'Undefined function 'plus' for input arguments of type 'function_handle'.'
Error in @(h)Vbody+Vlungs+Vsuit
EDU>> rhow = 1025;
g = 9.81;
P0 = 101325;
gamma = 1.4;
m = 67;
Vbody = 0.06;
Vlungs0 = 0.004;
tol = 0.01;
%Anonymous Functions:
P = @(h) P0 + rhow * g * h;
Vlungs = @(h) ((P0)/(P))^(1/gamma) * Vlungs0;
Vsuit = @(h) 0.005 * exp(-0.035*h);
V = @(h) Vbody + Vlungs + Vsuit;
EDU>> V(2)
I give all my constants numerical values and then define the anonymous functions Vlungs and Vsuit, both are functions of h. Finally, I attempt to define another anonymous function V, which is also a function of h, using Vbody (a constant) and the two previously defined functions of h Vlungs and Vsuit. Is this not allowed and if not, is there a way around this? Thanks.

採用された回答

Matt J
Matt J 2013 年 10 月 30 日
編集済み: Matt J 2013 年 10 月 30 日
V = @(h) Vbody + Vlungs(h) + Vsuit(h);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGamma Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by