Matlab code to traditional symbolic notation conversion
조회 수: 18 (최근 30일)
이전 댓글 표시
Hello,
I am looking for a kind of converter which convert from a matlab code
e.^(x./2) * sin(ax)
To symbolic math notation.
Does MATLAB have some kind of tools to convert messy parenthesis and functions to more visual friendly notation ?
When my functions gets too complicated, it is difficult to read it and spot the errors in code version like this function at the below.
int((((x-z-0.5).^2 +(y-w).^2).^(-2)).*(1./(2.*pi.*0.25.^2)).*exp(-(1./(2.*0.25^2)).*(x.^2+ y.^2))./(10.*0.5.^(-4) +((x-z-0.5).^2 +(y-w).^2).^(-2)))
댓글 수: 0
채택된 답변
John D'Errico
2017년 3월 20일
pretty does not do what you want?
help pretty
syms x y z w
pretty(int((((x-z-0.5).^2 +(y-w).^2).^(-2)).*(1./(2.*pi.*0.25.^2)).*exp(-(1./(2.*0.25^2)).*(x.^2+ y.^2))./(10.*0.5.^(-4) +((x-z-0.5).^2 +(y-w).^2).^(-2))))
/ 2 2
| 5734161139222659 exp(- 8 x - 8 y )
| ---------------------------------------------------------------------------------------- dx
/ / 1 \ / 2 / 1 \2 \2
| ------------------------------ + 160 | | (w - y) + | z - x + - | | 2251799813685248
| / 2 / 1 \2 \2 | \ \ 2 / /
| | (w - y) + | z - x + - | | |
\ \ \ 2 / / /
댓글 수: 1
Steven Lord
2017년 3월 20일
The pretty function is one option. Writing your symbolic code in the Live Editor directly is another option. A third would be to convert your symbolic expression to LaTeX using the latex function and paste that code into the Live Editor's Equation editor.
syms a x
f = exp(x./2)*sin(a*x);
L = latex(f);
clipboard('copy', L);
Now add a LaTeX Equation to your Live Script (click the triangle next to Equation in the Live Editor tab of the Toolstrip) and paste the LaTeX equation code from the clipboard into the editor.
추가 답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!