matlab---出现?Error using ==> times Matrix dimensions must agree错误---求大神指导clear; clc;m=4;muX=[75,55,80,55,75,20];cvX=[0.15*ones(5,1);0.2];sigmaX=cvX.*muX;sLn=sqrt(log(1+cvX(1:5).^2)); mLn=log(muX(1:5))-sLn.^2/2;aEv=sqrt(6)*sigmaX(6)/p
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 22:24:10
matlab---出现?Error using ==> times Matrix dimensions must agree错误---求大神指导clear; clc;m=4;muX=[75,55,80,55,75,20];cvX=[0.15*ones(5,1);0.2];sigmaX=cvX.*muX;sLn=sqrt(log(1+cvX(1:5).^2)); mLn=log(muX(1:5))-sLn.^2/2;aEv=sqrt(6)*sigmaX(6)/p
matlab---出现?Error using ==> times Matrix dimensions must agree错误---求大神指导
clear;
clc;
m=4;
muX=[75,55,80,55,75,20];
cvX=[0.15*ones(5,1);0.2];
sigmaX=cvX.*muX;
sLn=sqrt(log(1+cvX(1:5).^2)); mLn=log(muX(1:5))-sLn.^2/2;
aEv=sqrt(6)*sigmaX(6)/pi; uEv=-psi(1)*aEv-muX(6);
muX1=muX; sigmaX1=sigmaX;
a=[1,0,2,1,0,-6;1,0,2,0,1,-6;0,1,2,1,0,-6;0,1,2,0,1,-6];
for k=1:m
x=muX; normX=eps;
while abs(norm(x)-normX)/normX>1e-6
normX=norm(x);
g=a(k,:)*x;
gX=a(k,:)’;
cdfX=[logncdf(x(1:5),mLn,sLn);1-evcdf(-x(6),uEv,aEv)];
pdfX=[lognpdf(x(1:5),mLn,sLn);evpdf(-x(6),uEv,aEv)];
nc=norminv(cdfX);
sigmaX1=normpdf(nc)./pdfX;
muX1=x-nc.*sigmaX1;
gs=gX.*sigmaX1;alphaX=-gs/norm(gs);
bbeta=(g+gX’*(muX1-x))/norm(gs);
x=muX1+bbeta*sigmaX1.*alphaX;
end
aa(:,k)=alphaX;
b(k)=bbeta;
end
rho=aa’*aa;
pF=1-mvncdf(b,0,rho,statset('TolFun',1e-6,'MaxFunEvals’,1e9))
matlab---出现?Error using ==> times Matrix dimensions must agree错误---求大神指导clear; clc;m=4;muX=[75,55,80,55,75,20];cvX=[0.15*ones(5,1);0.2];sigmaX=cvX.*muX;sLn=sqrt(log(1+cvX(1:5).^2)); mLn=log(muX(1:5))-sLn.^2/2;aEv=sqrt(6)*sigmaX(6)/p
你程序第六行点乘的两个数的维数不一样,cvX是6*1维的,muX是1*6维的,你看看哪个需要转置下