Defining anonymous with other anonymous functions.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
David
el 30 de Oct. de 2013
Comentada: David
el 30 de Oct. de 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.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Function Creation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!