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 个评论
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!