lsqcurvefit where function changes for every y
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!