# How to Use Symbols Greek  Letters   Subscripts  Superscripts in Matlab Plot

In the video, how to use Greek letters, subscript, superscript, symbols in Matlab Plot,  i.e., in formatting of the Matlab plot is explaned.

Video explanation on How to use Symbols in Matlab plot

Let us take the Figue. 1, which is represented with all possible options by using symbols, Greek letters and super and subscripts are also shown.

Figure 1: Formatting of Matlab figure with symbols, Greek letters and super and subscripts

## •    Subscript

–    For single character, use ‘_’ for subscript
Ex: Va is V_a
–    For string, use ‘_{ }’ for subscript
Ex: Vab is V_{ab}

## •    Superscript

–    Single character, use ‘^’ for subscript
Ex: Va is V^a
–    For string, use ‘^{ }’ for subscript
Ex: Vab is V^{ab}
•    For both Subscript and Superscript
Use _ or ^ after the letter or for string use { }

Ex: Axy is A^x_y or Axa ya is A^{xa_{ ya}

## Greek characters

•    Use of Greek Letters
–    \name of the  Greek letter within the string
•    Lower  Greek Letters
–    Name of the Greek letter in all small letters
–    Ex: \gamma,
•    Upper Greek Letters
–    Ex: \Gamma,

%% Matlab Symbols Sub and super scripts

Example1:

Figure for the following program is given in the Figure 1.

Ax=[1.0  1.7  2.5  3.4  5.1  6.5  7.1 8.2 10];
Ay=[1.8 2.5 6.2  7.2 8 4.5 5.7 6.3 9];
plot(Ax,Ay,’r–o’,’linewidth’,3, ‘markersize’,10, ‘markeredgecolor’, ‘k’,’markerfacecolor’,’g’)
title(‘Plot of A^x vs A_y’,’fontsize’,18)
xlabel(‘A^x’,’fontsize’,18)
ylabel(‘A_y’,’fontsize’,18)
legend(‘label1, A^{xy}’,4,’fontsize’,18)
gtext(‘cos \phi’,’color’,’r’,’fontsize’,18)
gtext(‘cos \Phi’,’fontsize’,18)
gtext(‘sin \delta’,’fontsize’,18)
gtext(‘sin \Delta’,’fontweight’,’bold’,’fontsize’,18)
gtext(‘ \lambda’,’fontsize’,18)
gtext(‘ \Lambda’, ‘fontangle’,’italic’,’fontsize’,18)
gtext(‘\Re’,’fontsize’,18,’color’,’r’)
gtext(‘\downarrow’,’fontsize’,18)
gtext(‘\heartsuit’,’fontsize’,18,’color’,’b’)
gtext(‘\clubsuit’,’fontsize’,18,’color’,’m’)
gtext(‘\infty’,’fontsize’,18)

Example2:

This example shows how to use Greek symbols with formatting in the labels.

x = -pi:pi/100:pi;
y = sin(x);
plot(x,y)
axis([-pi pi -1 1])
ylabel(‘sin(x)’)
xlabel(‘-\pi \leq {\itx} \leq \pi’)
title(‘\fontsize{16}Graph of the sine function’)
text(1,-1/3,’\bf{Note the odd symmetry.}’)
gtext(‘\it{Note the odd symmetry.}’)

Example 3

This example shows how to use Greek letters in the title , labels and inside the plot.
x = -pi:pi/100:pi;
y = sin(x);
plot(x,y)
axis([-pi pi -1 1])
xlabel(‘-\pi \leq \Theta \leq \pi’)
ylabel(‘sin(\Theta)’)
title(‘Plot of sin(\Theta)’)
text(-pi/4,sin(-pi/4),’\leftarrow sin(-\pi\div4)’,…
‘HorizontalAlignment’,’left’)

Example 4:

This example shows you how to tick the x or y labels with symbols. This is done by accessing the properties of the current figure, i.e., graph handles which will be discussed in other section.
x = -pi:.1:pi;
y = sin(x);
plot(x,y)
set(gca,’XTick’,-pi:pi/2:pi)
set(gca,’XTickLabel’,{‘-pi’,’-pi/2′,’0′,’pi/2′,’pi’})