We always need figure to demonstrate the data we have.
Here gives an example of the basic way to use figure and plot:
% Start
x = -100:0.1:100;
y1 = x + 1;
y2 = x .* x;
figure(1); % create a new figure 1
plot(x, y1); % plot two curves in one figure
hold on; % To keep current curve appear
plot(x, y2);
% you can actually use the following one, it works the same
% plot(x,y1, x,y2);
legend('y1', 'y2'); % add lengeds
title('Plot Demonstration'); % title of the plot
xlabel('x'); ylabel('y') % label of axis
axis([-5 5 -10 10]); % scale of axes [xmin xmax ymin ymax]
set(gca, 'XTick', (-5: 1: 5)); % set the step of axes [min: step: max]
set(gca, 'YTick', (-10: 2: 10));
grid on; % plot with grid on
% Other constructing method
x = 1:5:100;
Two = 3 * x - 2;
figure('Name', 'Two', 'NumberTitle', 'off'); % create