How to show the variable name instead of its value in a plot's text, when using "syms", "text" and "latex" functions
4 views (last 30 days)
Question: By using both syms, latex and text functions/tools (as in the example here below), how can I show the variable name instead of its value, in a plot's text ?
What I currently have: In this example, if I assign a value to the variable "a", i.e. "a = 0.01", the latex function will show its value, i.e. "0.01" (i.e. "1/100") and not its name, i.e. "a".
a = 0.01 ;
y = exp(-a*x); % equation to show inside the plot
fplot(y, [0 500])
text(100,0.5, ['$y = ' latex(y) '$'], 'Interpreter','latex', 'FontSize',16)
My desired output: If possible, I would like to still use both syms, latex and text functions/tools (as in my example), and see/show the variable name "a" in the plot's text, instead of its value "0.01" (i.e. "1/100").