Representing Symbolic Variables as Equations in Live Scripts
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Guillermo Rubio Gomez
el 4 de Oct. de 2019
Respondida: Steven Lord
el 4 de Oct. de 2019
I would like to represent the content of symbolic variables as equations in a Live Script.
So far i'm trying with texlabel function:
texlabel(dtheta)
ans = '({L_{2}} ({L_{2}}^{2} - {L_{1}}^{2} - {2} {W} {w} + {W}^{2} + {w}^{2}))/({2} {L_{1}}^{2} ({W} - {w})^{3} ({1} - ({L_{1}}^{2} - {L_{2}}^{2} + ({W} - {w})^{2})^{2}/({4} {L_{1}}^{2} ({W} - {w})^{2}))^{{3}/{2}})'
Then I copy the output Tex expression into an equation, pasting as LaTex expression:
However, it doesn't recognize the fraccions.
I can see that, by clicking the variable in the LiveScript, the expression appears perfectly.
Is there any better way to do it?
Thank you very much.
0 comentarios
Respuesta aceptada
Steven Lord
el 4 de Oct. de 2019
Hmm. It looks like texlabel doesn't do any special processing for fractions. That kind of makes sense; ideally you wouldn't want the labels for your axes to be so tall that they protrude into the visible space of the axes or extend beyond the limit of the figure window.
Since you're working with symbolic expressions, I'd probably just use the latex function. I'll make a symbolic expression:
>> syms a b c x
>> S = solve(a*x^2+b*x+c == 0, x)
S =
-(b + (b^2 - 4*a*c)^(1/2))/(2*a)
-(b - (b^2 - 4*a*c)^(1/2))/(2*a)
Let's convert that to LaTeX and copy it to the clipboard.
>> clipboard('copy', latex(S));
Now open a Live Editor window and in the Insert tab of the Toolstrip click the triangle under the Equation icon. Select LaTeX Equation and paste into the box where you're asked to enter your LaTeX equation code.
Or since you're working in the Live Editor anyway, just run the first two lines of my example in the Live Editor. The output will be formatted in "pretty print" form.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!