Parameter optimization - lsqnonlin with normcdf
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
berbay
le 27 Mai 2020
Réponse apportée : Raunak Gupta
le 30 Mai 2020
Hi all,
I'm trying to optimize parameters with lsqnonlin to fit data. Actual data is market prices of options and I try to fit parameters to get those prices. However, since the formula is
and d1 is expressed as and v is a function of several parameters that I'd like to optimize. Initial parameters works well but when I run lsqnonlin v goes to negative at some point and I get an error of inputs must be real for erf function in normcdf. I made that non-negative using if statement in function v but then optimization doesn't work well.
I appreciate any lead to avoid this.
Best,
0 commentaires
Réponse acceptée
Raunak Gupta
le 30 Mai 2020
Hi,
I see that the optimization variable in the question is v. Since in lsqnonlin you are mentioning v as your parameter I suggest to put a lower bound lb equal to 0 so that optimization will not return value less than zero.This can be done as mentioned in this example.
Upper bound can be mentioned as ‘inf’ because v can be any positive real number. You may remove if statement for checking the value of v because the functionality of putting bounds on optimization variable is available in lsqnonlin.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!