Convert optimization problem from R to Matlab

4 ビュー (過去 30 日間)
Carlos Bosley
Carlos Bosley 2019 年 7 月 25 日
コメント済み: Carlos Bosley 2019 年 7 月 25 日
I have the following code from R:
fleishtarget<-function(x,a){
##
#The target function for solving equations 18, 19, and 20#
# from page 523 of Fleishman.#
#It does this by changing the system of three equations into a #
# minimization problem. Set the equations equal to zero, square,#
# and sum up. The b, c, and d that minimize the set of equations #
# at zero must also solve the three individually.#
##
b<-x[1]
cc<-x[2]
d<-x[3]
g1<-a[1]
g2<-a[2]
(2 - ( 2*b^2 + 12*b*d + g1^2/(b^2+24*b*d+105*d^2+2)^2 + 30*d^2 ) )^2 +
(g2 - ( 24*(b*d+cc^2*(1+b^2+28*b*d)+d^2*(12+48*b*d+141*cc^2+225*d^2)) ) )^2+
(cc - (g1/(2*(b^2+24*b*d+105*d^2+2)) ) )^2
}
findbcd<-function(skew,kurtosis){
##
#Uses the built in minimization function to solve for b, c, and d#
# if the skew and kurtosis are given. Try findbcd(1.75,3.75) and#
# compare to Table 1 on page 524 of Fleishman.
##
optim(c(1,0,0),fleishtarget,a=c(skew,kurtosis),method="BFGS",
control=list(ndeps=rep(1e-10,3),reltol=1e-10,maxit=1e8))
}
The cannot seem to translate this the call to optim into Matlab and get it working properly. Any help is greatly appreciated.

回答 (1 件)

amin ya
amin ya 2019 年 7 月 25 日
Have you tried this?
You need to study Matlab optimizatoin toolbox document to do this.
  1 件のコメント
Carlos Bosley
Carlos Bosley 2019 年 7 月 25 日
The only problem I am having is the call to optim in the function findbcd. I don't see how believe that link helps me with this.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by