function handles
Mostrar comentarios más antiguos
Hi,
I want to create a function that calculates a equation, say for example
function [n] = ns(dBcalc,wave, zL)
n = @(dBcalc,wave,zL) log(10^(dBcalc/10))/((4*pi*zL)/wave);
end
but when I try to call this by ns(14,765e-9,e-2) it does not work. I get error saying I get to many output arguments or calling the function it simply gives back the function (i.e. it prints the function n ) not the value.
I tried to also removed the @(dBcalc,wave,zL) but still I get errors. I tried some basic equation and that works but not this. Not sure where the mistake comes from?
4 comentarios
Oleg Komarov
el 30 de Mayo de 2012
It is expected to return the anonymous function because 'function ns()' just defines the function but does not execute the operations.
Lizan
el 30 de Mayo de 2012
Lizan
el 30 de Mayo de 2012
Lizan
el 30 de Mayo de 2012
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!