Symbiological output using 'syms' and 'pretty' commands

7 vues (au cours des 30 derniers jours)
Jay
Jay le 25 Nov 2021
Commenté : Star Strider le 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)

Réponse acceptée

Star Strider
Star Strider le 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 commentaires
Jay
Jay le 29 Nov 2021
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.
Star Strider
Star Strider le 29 Nov 2021
As always (our) pleasure!
.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by