Using greek letters as variables and as subscript in Matlab

159 次查看(过去 30 天)
I want to write two things :
  • first B and puttings theta as letter not word as subscripts
  • second : using lambda or others as variables in the function or scriptsphip=phix+asind(cosd(lambda)*sin(D)/cosd(lambdap))

采纳的回答

Walter Roberson
Walter Roberson 2017-11-23
Sorry, the only characters that can be used in variable names or function names are:
  • must start with one of A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
  • after that, each character must be one of A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or _ (underscore)
  • maximum of 63 characters in the identifier.
You might want to look at Live Script, which allows you to insert equations and formula as comments and which can be displayed as output.
  2 个评论
F.O
F.O 2017-11-23
This is not practical at all as we need those all the time in physics and mathematics
Walter Roberson
Walter Roberson 2017-11-23
If your system locale is set to English then you can include characters up to char(255) in the source code directly, inside character vectors or string objects or comments.
If your locale is set to some other languages (in particular Korean, Chinese, or Japanese, and possibly others) and your MATLAB is new enough, then you can include characters up to char(65535) in the source code directly, inside character vectors or string objects or comments. But test this before you go very far: if you do not see an option in your File menu to save as UTF-8 then your MATLAB might not support this.
If you are using OS-X then there is a preference hack to enable UTF-8 inside character vectors or string objects or comments; I have never tried using that myself.
However, there is no support for using any characters outside of char(32) to char(126) (together with char(9) [tab], char(10) (newline), and char(13) (carriage return)) in MATLAB source code outside of character vectors or string objects or comments .
I have no information as to whether this will ever change.. eventually, perhaps.
I suggest opening a service request and making your use case known; Mathworks prioritizes changes based upon customer demand in service requests.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by