matlabmatrixgraphicsfigureforwarderrorcorrection

Matlab: Adding symbols to figure


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

alt text

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 improve 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.


Solution

  • 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.