Symbiological output using 'syms' and 'pretty' commands

3 次查看(过去 30 天)
Hi all,
I am having issues outputting the factored polynomial using the below commands using MatLab 2021b (academic license) sybologically.
I have the Symbology Toolbox 'Installed' and can't determine what the issues is.
The online R2021b 'Run' command outputs (MatLab Desired Output.GIF red box) also aren't outputting in my Command Window on my license.
The 'Attachment with run function' also isn't working for the 2021b forum posting. When
I= imread('PolySolver.GIF')
Error using imread>get_full_filename (line 569)
File "PolySolver.GIF" does not exist.

Error in imread (line 371)
fullname = get_full_filename(filename);
is ommited (online) the answer (ans) is outputted as desired (MatLab Desired Output.GIF).
%% Factor Command
syms x
f1 = factor (x^3 + 2*x -3, x) % Directly below not showing on PC version of 2021b
% Make the factorisation 'pretty'
% Status: Not working
pretty(f1)
% Output
I= imread('PolySolver.GIF')
imshow = I % Attachment with run function not working for 2021b - Online posting
% Desired
(x - 1), (x^2 + x + 3)

采纳的回答

Star Strider
Star Strider 2021-11-25
Experiment with the indexing into the expressions (since this is a straightforward solution to a number of otherwise difficult problems in MATLAB).
Are these the desired results?
%% Factor Command
syms x
f1 = factor (x^3 + 2*x -3, x) % Directly below not showing on PC version of 2021b
f1 = 
f1(1)
ans = 
f1(2)
ans = 
% Make the factorisation 'pretty'
% Status: Not working
pretty(f1)
( 2 ) x - 1, x + x + 3
% Output
I= imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/812799/PolySolver.GIF');
imshow(I) % Attachment with run function not working for 2021b - Online posting
Right-click to copy the full file name to open the file in the in the online Run application. (This works except for .m files, that are painful to use with it.)
.
  11 个评论
Jay
Jay 2021-11-29
Thanks @Star Strider, I'll look into the new string variable and if it doesn't do as I would like, I'll just have to get used to the output and deal with it :).
Thanks again for your help gents.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by