From: Olina Duan on
function fun=myfun(m,x);
a=double(2/m(1));
b=double((m(2)-1)/m(1));
c=double(1/m(1));
d=double(m(2)/m(1));
e=double(3/m(1));
g=double((m(2)-2)/m(1));
h=beta(a,b);
i=beta(c,d);
j=beta(e,g);
m(3)=2/(1+e^(-m(3)))-1;
S=(1+3*m(3).^2-4*m(3).^2*h.^2.*i.^(-1).*j.^(-1)).^(1/2);
K=(m(1)/(m(2)-2)).^(1/m(1)).*i.*j.^(-1/2).*(1/S);
C=m(1)*i.^(-3/2)*j.^(1/2)*S*(1/(2*m(4)));
if x<0
f=C*(1+(m(1)/(m(2)-2)).*(1-m(3)).^(-m(1)).*K^(-m(1))*(abs(x/m(4))).^(m(1))).^(-((m(2)+1)/m(1)));
else f=C*(1+(m(1)/(m(2)-2)).*(1+m(3)).^(-m(1)).*K^(-m(1))*(abs(x/m(4))).^(m(1))).^(-((m(2)+1)/m(1)));
fun=-sum(log(f));
end
y=fminsearch(@(m) myfun(m,x),[398.8419,2,11.58563,0.02862],optimset('MaxFunEvals',1e10,'MaxIter',1e5))
Is there any question in this code, warning in 'fun=-sum(log(f));'?
From: us on
"Olina Duan" <tuzixiaona(a)sina.com> wrote in message <i1b214$9ci$1(a)fred.mathworks.com>...
> function fun=myfun(m,x);
> a=double(2/m(1));
> b=double((m(2)-1)/m(1));
> c=double(1/m(1));
> d=double(m(2)/m(1));
> e=double(3/m(1));
> g=double((m(2)-2)/m(1));
> h=beta(a,b);
> i=beta(c,d);
> j=beta(e,g);
> m(3)=2/(1+e^(-m(3)))-1;
> S=(1+3*m(3).^2-4*m(3).^2*h.^2.*i.^(-1).*j.^(-1)).^(1/2);
> K=(m(1)/(m(2)-2)).^(1/m(1)).*i.*j.^(-1/2).*(1/S);
> C=m(1)*i.^(-3/2)*j.^(1/2)*S*(1/(2*m(4)));
> if x<0
> f=C*(1+(m(1)/(m(2)-2)).*(1-m(3)).^(-m(1)).*K^(-m(1))*(abs(x/m(4))).^(m(1))).^(-((m(2)+1)/m(1)));
> else f=C*(1+(m(1)/(m(2)-2)).*(1+m(3)).^(-m(1)).*K^(-m(1))*(abs(x/m(4))).^(m(1))).^(-((m(2)+1)/m(1)));
> fun=-sum(log(f));
> end
> y=fminsearch(@(m) myfun(m,x),[398.8419,2,11.58563,0.02862],optimset('MaxFunEvals',1e10,'MaxIter',1e5))
> Is there any question in this code, warning in 'fun=-sum(log(f));'?

most CSSMers will say: guess so...
....since you (seem) to get a warning, which you happen to not disclose to this NG...

THINK - then POST...

us