Error using indexing Too many output arguments.

2 views (last 30 days)
Hello! I have an error went I run this code. Its show "Error using indexing Too many output arguments." Initially its can be run until I added some this equation that I bold here and its become error. Anyone can help me to fix this error or give some idea to make this equation becomes more simple bcause its only 10% from the whole equation.
syms s1 c1 c2 s2 c3 s3 c4 s4 n1 n2 n3 b1 b2 b3 real
B = [c2.*c3.*c4-s2.*s4 -c2.*s3 c2.*c3.*s4+s2.*c4;s1.*s2.*c3.*c4+c1.*c4.*s3+s1.*s4.*c2 -s1.*s2.*s3+c1.*c3 s1.*s2.*s4.*c3+c1.*s3.*s4-s1.*c2.*c4; -c1.*s2.*c4.*c3+s1.*s3.*c4-c1.*c2.*s4 c1.*s2.*s3+s1.*c3 -c1.*s2.*s4.*c3+s1.*s3.*s4+c1.*c2.*c4]
B = [c2.*c3.*c4-s2.*s4, -c2.*s3, c2.*c3.*s4+s2.*c4;
s1.*s2.*c3.*c4+c1.*c4.*s3+s1.*s4.*c2, -s1.*s2.*s3+c1.*c3, s1.*s2.*s4.*c3+c1.*s3.*s4-s1.*c2.*c4;
-c1.*s2.*c4.*c3+s1.*s3.*c4-c1.*c2.*s4, c1.*s2.*s3+s1.*c3, -c1.*s2.*s4.*c3+s1.*s3.*s4+c1.*c2.*c4]
b1 = [1 0 0]'
b2 = [0 1 0]'
b3 = [0 0 1]'
n1 = [1 0 0]'
n2 = [0 1 0]'
n3 = [0 0 1]'
g=9.81; mB=1.1111; PB=0.19336;
Nv1Bstar_1 = (mB.*g.*PB.*(((b2.*B.*n3').*(c4.*s2))-((b1.*B.*n3').*(c2.*s3))-((b1.*B.*n3').*(c4.*s2))+((b3.*B.*n3').*(c2.*s3))+((b2.*B.*n3').*(s2.*s4))-((b3.*B.*n3').*(s2.*s4))-((b2.*B.*n3').*(c2.*c3.*c4))+((b3.*B.*n3').*(c2.*c3.*c4))-((b1.*B.n3').*(c2.*c3.*s4)))-((b2.*B.*n3').*(c2.*c3.*s4))))

Answers (1)

the cyclist
the cyclist on 29 Oct 2023
Edited: the cyclist on 29 Oct 2023
I'm guessing that in the expression
(b1.*B.n3')
you intended
(b1.*B.*n3')
The specific error is because the syntax you used would try to access B.n3 as if it were a field of a structure array.

Community Treasure Hunt

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

Start Hunting!