Matlab:向图中添加符号
下面是我创建的用于模拟 LDPC 编码和解码的用户界面
通过通过连接在左右节点之间传递值来迭代解码代码序列。
为了改进可视化,最好添加的第一件事是在传递值的方向上向连接添加箭头。另一种方法是在连接顶部画一个更大的箭头来显示方向。
我想做的另一件事是在连接下方显示当前的数学运算(在此示例中 c * H'
)。我不知道该怎么做是在图中显示特殊字符和数学符号以及其他类型的文本,例如下标和上标(例如和号和下标“T
”而不是 sign ="'"
表示转置矩阵)。
如果有人能为上述问题指出任何有用的资源或展示解决方案,我将非常感激。
谢谢。
Below is the user interface I have created to simulate LDPC coding and decoding
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要添加箭头,您可以使用内置的 QUIVER< /a>,或者,如需更多选项,请从文件交换中按 箭头。这两个轴都必须绘制成轴,因此如果您希望顶部有一个大箭头,则必须在主轴上方创建一组附加轴。
据我所知,您不能在
text
uicontrols 中使用 TeX 或 LaTeX 符号。但是,您可以在轴标签中使用它们。因此,我建议您向轴添加一个XLabel
,例如或者(注意 LaTeX 所需的 $ 符号)
编辑
我没有提到使用 < code>text (按照 @gnovice 的建议和@YYC)因为我认为不可能放置文本轴之外。事实证明我错了。
text(0.5,-0.2,'\Sigma etc.')
也应该可以正常工作。我想使用“xlabel”的唯一优点是您可以在 GUI 创建过程中轻松添加和定位轴标签。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 anXLabel
to the axes, for exampleor (note the $-signs required for 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.关于第一个问题,注释(http://www .mathworks.com/access/helpdesk/help/techdoc/ref/annotation.html)可能是一种替代解决方案。
关于第二个问题,尝试 text 属性在 Matlab 帮助中。
在“字符序列”中搜索特殊字符;搜索“指定下标和上标字符”查找下标和上标。
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.
为了绘制箭头,我会参考 Jonas 的建议 arrow.m by Erik Johnson 在 MathWorks 文件交换。这是我发现的在图形中创建箭头的最简单方法。
要创建带有符号的文本,您可以使用函数 TEXT。它允许您将文本放置在坐标区中的给定点,并且您可以使用
'tex'
(默认)或'latex'
选项作为'Interpreter'
属性 获取访问不同的符号。例如,使用'latex'
作为解释器将所需的文本放置在点 (0,0):变量
hText
是创建的文本对象的句柄,然后您可以将其与 SET 命令一起使用更改对象的属性(字符串、位置等)。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: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.).