Using greek letters as variables and as subscript in Matlab

90 visualizaciones (últimos 30 días)
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))

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Nov. de 2017
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 comentarios
F.O
F.O el 23 de Nov. de 2017
This is not practical at all as we need those all the time in physics and mathematics
Walter Roberson
Walter Roberson el 23 de Nov. de 2017
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by