lsqcurvefit where function changes for every y

I would like to do something like this
f = @(lambda, x) obj.tranchePrice(lambda, x, groupings);
[x, resnorm, residual] = lsqcurvefit(f, x0, xdata, obj.cdoTrancheData);
and the function
function price=tranchePrice(obj, lambda, ~)
... bla bla
% Then I need to know which tranche I am in.
% I.e the index of the y in the provided data is currently tested,
% because the tranches has different attachment and detachment points,
% which makes the following calulations hard.
for k=1:n
defaultLeg = cdoDefaultLeg(k, n, normAttach, normDetach)
protectionLeg = obj.cdoProtectionLeg(defaultLeg, normAttach, normDetach)
...
end
end
So there is one atachment and detachment point for every y provided in the lsqcurvefit function. But I dont know how I find the right points when in the tranchePrice function.

답변 (0개)

이 질문은 마감되었습니다.

태그

질문:

2012년 3월 28일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by