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

1 view (last 30 days)
[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;

Accepted Answer

Torsten
Torsten on 21 Feb 2022
r5guess.*cos(th5guess)
r5guess.*sin(th5guess)
instead of
r5guess.cos(th5guess)
r5guess.sin(th5guess)
  5 Comments
Bryan Tassin
Bryan Tassin on 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 on 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)];

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!