Dot indexing is not supported for variables of this type. How to fix this?

1 Ansicht (letzte 30 Tage)
[th3,th4,th5,r5] = NR(th1,th2(i),th3guess,th4guess,th5guess,r1,r2,r3,r4,r5guess);
J = [-r3.*sin(th3guess),-r4.*sin(th4guess),0,0;...
r3.*cos(th3guess),r4.*cos(th4guess),0,0;...
0,0,-r5guess.*sin(th5guess),cos(th5guess);...
0,0,r5guess.*cos(th5guess),sin(th5guess)];
dth = J\f;
th3guess = th3guess+dth(1);
th4guess = th4guess+dth(2);
th5guess = th5guess+dth(3);
r5guess = r5guess+dth(4);
f = [-(r2 + r3.*cos(th3guess) - r4.*cos(th4guess));...
-(0 + r3.*sin(th3guess) - r4.*sin(th4guess));...
-(0 + r5guess.cos(th5guess) - 0);... %<== error occurs here
-(0 + r5guess.sin(th5guess) - 0)];
th3 = th3guess;
th4 = th4guess;
th5 = th5guess;
r5 = r5guess;

Akzeptierte Antwort

Torsten
Torsten am 21 Feb. 2022
r5guess.*cos(th5guess)
r5guess.*sin(th5guess)
instead of
r5guess.cos(th5guess)
r5guess.sin(th5guess)
  5 Kommentare
Bryan Tassin
Bryan Tassin am 21 Feb. 2022
I figured it out. The output was creating the same number for 360 iterations for each variable. Thanks for your help.
Torsten
Torsten am 22 Feb. 2022
J = [-r3.*sin(th3guess),r4.*sin(th4guess),0,0;...
r3.*cos(th3guess),-r4.*cos(th4guess),0,0;...
0,0,-r5guess.*sin(th5guess),cos(th5guess);...
0,0,r5guess.*cos(th5guess),sin(th5guess)];
instead of
J = [-r3.*sin(th3guess),-r4.*sin(th4guess),0,0;...
r3.*cos(th3guess),r4.*cos(th4guess),0,0;...
0,0,-r5guess.*sin(th5guess),cos(th5guess);...
0,0,r5guess.*cos(th5guess),sin(th5guess)];

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by