matrix dimension mismatch problem

1 visualización (últimos 30 días)
Debasish Mishra
Debasish Mishra el 27 de Jun. de 2020
Comentada: Star Strider el 27 de Jun. de 2020
hiii
i have an issue of matrix dimension mismatch..i have this following code.
R=1:1:500;
d=[1 2 3 4];
delB=1;
Bmn=1;
a=1+((delB*d)-(Bmn*d./Rb)).^2;
b=1+(delB*d).^2-(Bmn*d./Rb).^2;
c=1+((delB*d)+(Bmn*d./Rb)).^2;
hmn=1.414*kpqt^2*d*((1./(sqrt(a.*(b+sqrt(a.*c)))))+(1./(sqrt(c.*(b+sqrt(a.*c))))));
XT=tanh(hmn*L);
This is showing matrix dimention mismatch.
plz help me out..
thank u in advance.

Respuestas (2)

madhan ravi
madhan ravi el 27 de Jun. de 2020
d = (1:4).';

Star Strider
Star Strider el 27 de Jun. de 2020
The assignment to ‘Rb’ appears to be missing. Since you are using element-wise division wih it, it appears to be a vector, so I created it as a random (1x4) vector to match ‘d’. (Also, ‘kpqt’ and ‘L’ are missing, although they appear to be a scalars.)
Assuming that ‘Rb’ is also a (1x4) vector, do element-wise multiplication:
hmn=1.414*kpqt^2*d.*((1./(sqrt(a.*(b+sqrt(a.*c)))))+(1./(sqrt(c.*(b+sqrt(a.*c))))));
↑ ← HERE
If the undefined variables have different row and column sizes than I assumed here, my Answer may need to change.
  2 comentarios
Debasish Mishra
Debasish Mishra el 27 de Jun. de 2020
thanx for responding.actually i wrote Rb to be R by mistake.R and Rb both are same.
Star Strider
Star Strider el 27 de Jun. de 2020
My pleasure!
In that situation, you also need to transpose either ‘d’ or ‘R’ (although not both).
My original Answer remains valid with those changes, since that multiplication needs to be element-wise either way.
.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by