Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

i have an error:Assignment has more non-singleton rhs dimensions than non-singleton subscripts

1 vue (au cours des 30 derniers jours)
alireza amiri
alireza amiri le 28 Fév 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hi
i have this error in line 77 and 81 in matlab:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
please help me.
h = 1;
Lr = 1.5;
Lz = 1;
dr = 0.01429;
dz = 0.01429;
r = 0:dr:Lr;
z = 0:dz:Lz;
i = 0;
j = 0;
k_m = 1.80;
k_c = 1.65;
G_m = 0.76;
G_c = 1.24;
ro_m = 8.3;
ro_c = 3.7;
for z = 0:dz:Lz
i=i+1;
j=0;
for r = 0:dr:Lr
j=j+1;
n=1;
v_m(i,j) = ((z/h)^n);
v_c(i,j) = (1-v_m(i,j));
k(i,j) = k_m+(v_c(i,j)*(k_c-k_m)/(1+(1-v_c(i,j))*(3*(k_c-k_m)/3*k_m+4*G_m)));
f1 = G_m*(9*k_m+8*G_m)/6*(k_m+2*G_m);
G(i,j) = G_m+(v_c(i,j)*(G_c-G_m)/(1+(1-v_c(i,j))*((G_c-G_m)/G_m+f1)));
E(i,j) = 9*k(i,j)*G(i,j)/(3*k(i,j)+inv(G(i,j)));
nu(i,j) = (3*k(i,j)-2*G(i,j))/2*inv(3*k(i,j)+G(i,j));
ro(i,j) = v_m(i,j)*ro_m+v_c(i,j)*ro_c;
landa(i,j) = E(i,j)*nu(i,j)/((1+nu(i,j))*(1-2*nu(i,j)));
mu(i,j) = E(i,j)/(2*(1+nu(i,j)));
cl(i,j) = ((landa(i,j)+2*mu(i,j))/ro(i,j))^0.5;
cs(i,j) = (mu(i,j)/ro(i,j))^0.5;
q(i,j) = cs(i,j)/cl(i,j);
end
end
z=0:dz:Lz;
r=0:dr:Lr;
dt=1e-8;
t=0:dt:50e-6;
u=zeros(length(z),length(r),length(t));
w=zeros(length(z),length(r),length(t));
for h=1:length(r)
u(1,h,:)=0.001;%*sin(pi*t/5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w(i-1,j,k)...
+(1/i*dr)*(1/2*dr)*(w(i+1,j,k)-w(i-1,j,k)))+(1-q^2)*(u(i+1,j+1,k)-u(i+1,j-1,k)-u(i-1,j+1,k)+u(i-1,j-1,k))...
+(1/2*dz)*(w(i,j+1,k)-w(i,j-1,k)))+2*w(i,j,k)-w(i,j,k-1);
end
end
end

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by