Viewing Symbolic Matrix Entries in Variable Tab?

2 Ansichten (letzte 30 Tage)
Charlie Haimbaugh
Charlie Haimbaugh am 29 Jan. 2023
Is there a way to view a symbolic matrix in the variable tab instead of the command window? I know I can view it in the command window, but for a larger matrix columns move down into rows and is not a great UI. When opening variable view this is how it displays symbolic entries:
I can only see each entry after double clicking into it. Is there a view option to see the actual equations from the above screen?
Applications are primarily a Jacobian Matrix or any matrix equation with a matrix of derivatives used for numerical methods. I like to symbolically solve the derivative matrix, then use those derived equations in the iteration loop therafter to reduce compilation time by only differentiating once. Viewing the results is a nice sanity check.
Any tips are appreciated. -Charlie

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Jan. 2023
Bearbeitet: Walter Roberson am 2 Feb. 2023
No, No there is no way to do that.
If you
temp = arrayfun(@char, YourSymArray, 'uniform', 0);
openvar temp
then you will be able to see roughly the first 10 characters of each entry (unless you drag the edges to make the entries wider)
  2 Kommentare
Charlie Haimbaugh
Charlie Haimbaugh am 30 Jan. 2023
Great workaround, thanks!
Charlie Haimbaugh
Charlie Haimbaugh am 2 Feb. 2023
I now use this same concept in a function for viewing complex numbers in polar form in one go. Thanks again.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Steven Lord
Steven Lord am 30 Jan. 2023
If you're planning to use the symbolic expression in a loop you may want to create a MATLAB function file from it using matlabFunction. You could read the generated code as a check that the expression you're evaluating is what you expect it to be.
  1 Kommentar
Charlie Haimbaugh
Charlie Haimbaugh am 1 Feb. 2023
This is actually what I had first tried. My function was supposed to accept one variable t, and a vector of values x for each iteration. Converting the entire symbolic matrix equation to a function via matlabFunction resulted in the symbolic x values being distributed throughout (reshaping/simplifying the matrix equation when matlabFunction was called). Therefore, I could not pass in the vector as one variable x in the function handle.
I am sure there is a workaround as I had not implemented matlabFunction prior. I will investigate its use again in the future and try again. Thank you for confirming that it should work and is a good option. It would be my prefered method for speed and readability purposes.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by