Matlab shows symbolic result with new variabels

6 views (last 30 days)
I have an issue with the result display in matlab. I want to calculate the matrix "T04", however the matlab result implements new variables to describe the result, which is annoying and basically unreadable. Is there a way to force matlab to not create these new variabels of sigma, shown in the images?
syms theta1 theta2 theta3 L1 L2 L3
T01 = [cosd(theta1) -sind(theta1) 0 a1
sind(theta1)*cosd(alpha1) cosd(theta1)*cosd(alpha1) -sind(alpha1) -sind(alpha1)*d1
sind(theta1)*sind(alpha1) cosd(theta1)*sind(alpha1) cosd(alpha1) cosd(alpha1)*d1
0 0 0 1];
T12 = [cosd(theta2) -sind(theta2) 0 a2
sind(theta2)*cosd(alpha2) cosd(theta2)*cosd(alpha2) -sind(alpha2) -sind(alpha2)*d2
sind(theta2)*sind(alpha2) cosd(theta2)*sind(alpha2) cosd(alpha2) cosd(alpha2)*d2
0 0 0 1];
and so on...
T04 = T01*T12*T23*T34
I am using "syms" and matlab seems to know how to write the matrices fine, as seen below for "T01"
Neither subs() or eval() fixes the issues
  1 Comment
Rik
Rik on 10 Aug 2021
These are shortcuts to have a more compact result. That is why subs and eval don't fix anything. You might need to look into the options format provides, although there might be something specific to the syms toolbox.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 10 Aug 2021
The approach in Abbreviate Common Terms in Long Expressions might do what you want.
.

More Answers (1)

Morten Reimer
Morten Reimer on 11 Aug 2021
I found that simply inputting:
sympref('AbbreviateOutput',false);
in the beginning of the code, makes matlab not use abbreviations.
  1 Comment
Star Strider
Star Strider on 11 Aug 2021
I was not aware of that either until I searched the documentation and found the reference that I posted.
.

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!