Live script output shortened by 'where'
조회 수: 4 (최근 30일)
이전 댓글 표시
When I run a live script with symbolic expressions that have long terms the output is shortened by the introduction of new variables. How can I avoid this behaviour?
An example given here
syms theta_1 theta_2 theta_3 theta_4 theta_5
syms g
syms u_1 u_2 u_3
% define symbols
for i = 1:1:6
eval(strcat("syms x_", num2str(i)))
end
dx_1dt = theta_1*x_4 - theta_3*x_6*sign(x_1 - x_2)*sqrt(2*g*abs(x_1 - x_2));
dx_2dt = theta_3*x_6*sign(x_1 - x_2)*sqrt(2*g*abs(x_1-x_2))-theta_4*sign(x_2-x_3)*sqrt(2*g*abs(x_2-x_3));
dx_3dt = theta_4*sign(x_2-x_3)*sqrt(2*g*abs(x_2-x_3))+theta_2*x_5*sqrt(2*g*x_3);
dx_4dt = u_1;
dx_5dt = u_2;
dx_6dt = u_3;
f_dyn = [dx_1dt; dx_2dt; dx_3dt; dx_4dt; dx_5dt; dx_6dt]
See also the attached screenshot

Plenty of space to print the formula fully
댓글 수: 1
Ralf Hillebrand
2020년 3월 9일
By default, symbolic outputs are abbreviated to make the output as compact as possible. You can change the default behavior so that all symbolic outputs are expanded. To change the default, use this command:
sympref('AbbreviateOutput',false);
Please note that this preference is persistent over MATLAB sessions. To revert back to the original default, set the value to true.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!