Symbiological output using 'syms' and 'pretty' commands

3 views (last 30 days)
Jay
Jay on 25 Nov 2021
Commented: Star Strider on 29 Nov 2021
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)

Accepted Answer

Star Strider
Star Strider on 25 Nov 2021
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 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!