我必须执行copulapdf分析,并且需要创建8个不同的图形,从1到8的nu(在此代码中称为nuvar)变化。我是Matlab中的新手。我试图将其写为循环,但不起作用。有谁可以帮助我吗?
for nuvar= 1:1:8
for numvar1= 1:1:8
r=0.5;
nu=1;
u = linspace(0,1,20);
[u1,u2] = meshgrid(u,u);
rho1 = copulaparam('t',r,nu);
H(nuvar, numvar1) = copulapdf('t',[u1(:),u2(:)],rho1,nuvar);
surf(u1,u2,reshape(y,20,20))
end
end
我还尝试通过这种方式更正脚本:
r=0.5;
nu=1;
u = linspace(0,1,20);
rho1 = copulaparam('t',r,nu);
[u1,u2] = meshgrid(u,u);
for numvar1= 1:1:8
H(nuvar, numvar1) = copulapdf('t',[u1(:),u2(:)],rho1,nuvar);
surf(u1,u2,reshape(y,20,20))
end
I have the same error "Subscripted assignment dimension mismatch".