Filter löschen
Filter löschen

Defining anonymous with other anonymous functions.

1 Ansicht (letzte 30 Tage)
David
David am 30 Okt. 2013
Kommentiert: David am 30 Okt. 2013
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.

Akzeptierte Antwort

Matt J
Matt J am 30 Okt. 2013
Bearbeitet: Matt J am 30 Okt. 2013
V = @(h) Vbody + Vlungs(h) + Vsuit(h);

Weitere Antworten (0)

Kategorien

Mehr zu Gamma Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by