Display µm not correct in figure in Matlab

126 ビュー (過去 30 日間)
ly
ly 2014 年 12 月 22 日
コメント済み: Walter Roberson 2022 年 9 月 17 日
I use Matlab 2011b
I have code for figure like this:
...
set(0,'DefaultAxesFontName', 'Times New Roman')
set(0,'DefaultAxesFontSize', 12)
plot(x1,y1,'r',x2,y2,'MarkerEdgeColor','b')
xlabel('Zsnsr [µm]') %Display not correct
ylabel('DeflV')
set(gca,'XDir','reverse')
axis([xmin xmax ymin ymax])
(end)
....
and the figure Matlab draw like this picture (red line) I don't know why and how to solve this.
Thanks!
  1 件のコメント
Stephen23
Stephen23 2014 年 12 月 22 日
The xlabel documentation explains this under "Interpretation of text characters".

サインインしてコメントする。

採用された回答

Ilham Hardy
Ilham Hardy 2014 年 12 月 22 日
Try this,
xlabel('Zsnsr [\mum]','interpreter','Tex')
  2 件のコメント
ly
ly 2014 年 12 月 22 日
It is Ok. Thank!
But can you explain why it look that?
And what does "[\mum]','interpreter','Tex'" mean?
Thanks!
Ilham Hardy
Ilham Hardy 2014 年 12 月 22 日
But can you explain why it look that?
If you referering to the red line, it is obvious that your x1 and y1 data produce the red line plot (ergo, plot(x1,y1,'r'.. ). The 'r' means you want to plot the x1 and y1 in red color.
And what does "[\mum]','interpreter','Tex'" mean?
Tex is text-interpreter used widely to express symbols (e.g. mathematical symbol). The text to be interpret by the Tex (or LaTex) usually preceded with a backslash (\), in this case (\mu) is merely a command to write micron/mu label. Ergo '\mum' will create 'µm' label.
Hope this helps,

サインインしてコメントする。

その他の回答 (2 件)

ly
ly 2014 年 12 月 22 日
Thank a lot!

M.SEETHA LAKSHMI
M.SEETHA LAKSHMI 2022 年 9 月 17 日
how to write m() in matlab kindly send me the coding for this
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 17 日
title('\mu', 'interpreter', 'tex')
xlabel('$\mu$', 'interpreter', 'latex')
ylabel('μ', 'interpreter', 'none')
text(0.5, 0.5, 'μ', 'interpreter', 'tex')
However you cannot use 'μ' with interpreter latex, and when you use interpreter latex you need the dollar signs.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by