Output of matrices with symbolic values not being zero but instead being x*e^-17
Doing some modelling of mechatronic systems in a course right now, where there are matrices of symbolic values of angles, lengths etc. The output in some locations in the matrices should be zero (my lab partners gets 0), but my output is something like "(684969180613545*I3z)/182687704666362864775460604089535377456991567872" which equals 3.7494e-33. Is there a setting or such that gives me 0 instead?
if true % syms q1 q2 q3 real syms L1 L2 real q=[q1;q2;q3]; a=[0; L1; L2]; al=[-pi/2; 0; 0]; d=[0;0;0]; th=[q1; q2; q3-pi/2]; R=@(a,al,d,th)([cos(th), -sin(th)*cos(al), sin(th)*sin(al) sin(th), cos(th)*cos(al), -cos(th)*sin(al) 0, sin(al), cos(al)]); R0=eye(3); R1= R(a(1),al(1),d(1),th(1)); R10=R0*R1; end
Printing R10 gives the output
if true % code R10 = [ cos(q1), -(4967757600021511*sin(q1))/81129638414606681695789005144064, -sin(q1)] [ sin(q1), (4967757600021511*cos(q1))/81129638414606681695789005144064, cos(q1)] [ 0, -1, 4967757600021511/81129638414606681695789005144064]
end
Went through my lab partners preferences and mine and compared, but did not see any significant difference. Later on as the matrices become larger and more complex this becomes a real issue to provide answers to my report. Thankful for help!
// Erik
댓글 수: 0
답변 (2개)
댓글 수: 2
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!