@ function handle help for finance
Mostrar comentarios más antiguos
I'm trying to pass a funtion I have created called Itrend through another function. Itrend accepts two inputs, Alpha, and Lag. It outputs the sortino ratio. The function I want to run it through is designed to maximize the sortino ratio across a predefined range. This function is called parameterSweep, the code is here. The bolded part is what I can't format correctly:
range={.02:.005:.2,1:20}
fun = @(x) deal(Itrend(Alpha,Lag))
[respmax,varmax,resp,var] = parameterSweep(fun,range)
1 comentario
Will
el 20 de En. de 2012
Respuestas (3)
Walter Roberson
el 20 de En. de 2012
deal() is only used to return multiple outputs, which your description does not require.
You either want
fun = @(x) ltrend(x,Lag);
or
fun = @(x) ltrend(Alpha,x);
but we cannot tell from your description which. You said "range" but not which variable the range applies to.
1 comentario
Will
el 20 de En. de 2012
Honglei Chen
el 20 de En. de 2012
I don't quite see the relation of inputs. It looks like Alpha and Lag are constants and it has nothing to do with x, so what's the purpose of this function?
If Alpha and Lag is derived from range, then you may want to define it as following:
fun = @(Alpha,Lag) ltrend(Alpha,Lag)
2 comentarios
Will
el 20 de En. de 2012
Honglei Chen
el 20 de En. de 2012
Then it is just fun = @(Alpha,Lag) ltrend(Alpha,Lag), I'm also updating my answers above.
Will
el 20 de En. de 2012
Categorías
Más información sobre Transaction Cost Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!