MATLAB Answers

How to add an eguation into my plot?

1 view (last 30 days)
Sadegh Aberoumand
Sadegh Aberoumand on 21 Apr 2021
Answered: Walter Roberson on 21 Apr 2021
I have plotted my data but I need to add an equation in a textbox near to the lines in my plot. The textbox in the Insert seems to be not suitable as I need to use some symbols like gamma, tetha, alfa etc in the equation and these symbols are not available there. Or maybe I am wrong.
Any advice is appreciated much.

Answers (2)

Jonas on 21 Apr 2021
you can use the annotation command. e.g.
annotation('textbox',[0.1 0.1 0.1 0.1],'String','hello $\frac{2}{4} \alpha$ ','FitBoxToText','on','Interpreter','latex');
there you have any latex command available if you wish. or you use tex as interpreter

Walter Roberson
Walter Roberson on 21 Apr 2021
You can text() a label into position, and you can set the Interpreter property of the text() object to 'latex'


Community Treasure Hunt

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

Start Hunting!