lsqcurvefit where function changes for every y
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
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.
Risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!