开发者

Matlab: Adding symbols to figure

Below is the user interface I have created to simulate LDPC coding and decoding

Matlab: Adding symbols to figure

The code sequence is decoded iteratively by passing values between the left and right nodes through the connections.

The first thing it would be good to add in order to improv开发者_Go百科e visualization is to add arrows to the connections in the direction of passing values. The alternative is to draw a bigger arrow at the top of the connection showing the direction.

Another thing I would like to do is displaying the current mathematical operation below the connection (in this example c * H'). What I don't know how to do is displaying special characters and mathematical symbols and other kinds of text such as subscript and superscript in the figure (for example sum sign and subscript "T" instead of sign ="'" to indicate transposed matrix).

I would be very thankful if anyone could point to any useful resources for the questions above or show the solution.

Thank you.


To add arrows, you can either use the built-in QUIVER, or, for more options, ARROW from the file exchange. Both of these have to be plotted into axes, so if you want a big arrow on the top, you have to create an additional set of axes above the main axes.

As far as I know, you cannot use TeX or LaTeX symbols in text uicontrols. However, you can use them in axes labels. Thus, I suggest that you add an XLabel to the axes, for example

xlabel('\sigma c*H_T')

or (note the $-signs required for LaTeX)

xlabel('$\sum c*H_T$','interpreter','latex')

EDIT

I hadn't mentioned the use of text (as suggested by @gnovice and @YYC) because I thought it wasn't possible to place text outside of the axes. It turns out that I was wrong. text(0.5,-0.2,'\Sigma etc.') should work fine as well. I guess the only advantage of using 'xlabel' would be that you can easily add and position the axes label during GUI creation.


In regards to the 1st question, annotation (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/annotation.html) might be an alternative solution.

In regards to the 2nd question, try text property in Matlab Help.

Search "Character Sequence" for the special characters; search "Specifying Subscript and Superscript Characters" for the subscript and superscript.


For drawing the arrow, I would go Jonas' suggestion arrow.m by Erik Johnson on the MathWorks File Exchange. It's the easiest way I've found to create arrows in figures.

For creating text with symbols, you can use the function TEXT. It lets you place text at a given point in an axes, and you can use the 'tex' (default) or 'latex' options for the 'Interpreter' property to get access to different symbols. For example, this places the text you want at the point (0,0) using 'latex' as the interpreter:

hText = text(0,0,'$\sum c*H_T$','Interpreter','latex');

The variable hText is a handle to the text object created, which you can then use with the SET command to change the properties of the object (string, position, etc.).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜