matrix dimension mismatch problem

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.

Antworten (2)

Star Strider
Star Strider am 27 Jun. 2020

0 Stimmen

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 Kommentare

Debasish Mishra
Debasish Mishra am 27 Jun. 2020
thanx for responding.actually i wrote Rb to be R by mistake.R and Rb both are same.
Star Strider
Star Strider am 27 Jun. 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.
.

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 27 Jun. 2020

Kommentiert:

am 27 Jun. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by