Live script output shortened by 'where'
2 ビュー (過去 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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!