separate multiple data lables in matlab

To separate multiple data labels in Matlab, you can use the "legend" command along with the "DisplayName" property of the plotted data. This will create a legend with separate labels for each piece of data.

Here is an example code snippet:

main.m
x = 1:10;
y1 = x.^2;
y2 = x.^3;

plot(x,y1,'-o','DisplayName','y1');
hold on
plot(x,y2,'-s','DisplayName','y2');

legend('show');
130 chars
10 lines

In this code, the "DisplayName" property is used to label each set of data. The "legend" command is then used to create a legend with separate labels for y1 and y2.

You can customize the appearance of the legend using additional arguments in the "legend" command. For example, you can change the location, font size, or orientation of the legend:

main.m
legend('Location','southeast','FontSize',12,'Orientation','horizontal');
73 chars
2 lines

This will move the legend to the "southeast" corner of the plot, increase the font size to 12, and change the orientation to be horizontal.

gistlibby LogSnag