Error'incorrect dimensions for matrix multiplication'
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
phis=3;phib=8;
zeta=-.95:0.5:10;
Eg=[-2.9583 5.2519 -6.5456 5.2455 -0.4883 -7.0614 -6.5562];
xi=[1 1 1 1 1 1];
for n=1:1:6
if Eg(:,n)>=zeta
zeta=xi/phis-1;
F=xi*log(1+zeta)+phis*(Eg(n,:)-zeta);
elseif Eg(:,n)<zeta
zeta=xi/phib-1;
F=xi*log(1+zeta)+phib*(Eg(n,:)-zeta);
else
end
end
plot(zeta,F,'*')
How to correct the dimension of this matrix
0 comentarios
Respuestas (1)
VBBV
el 1 de Mzo. de 2022
Editada: VBBV
el 1 de Mzo. de 2022
phis=3;
phib=8;
zeta=-.95:0.5:10;
Eg=[-2.9583 5.2519 -6.5456 5.2455 -0.4883 -7.0614 -6.5562]
xi=[1 1 1 1 1 1];
for n=1:1:6
if Eg(:,n)>=zeta
zeta=xi/phis-1;
F(:,n)=xi.*log(1+zeta)+phis*(Eg(:,n)-zeta); % accessing incorrect index
elseif Eg(:,n)<zeta
zeta=xi/phib-1;
F(:,n)=xi.*log(1+zeta)+phib*(Eg(:,n)-zeta);
else
end
end
plot(zeta,F,'*')
check the sizeof Eg matrix
2 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!