clear, clc, close all

%Plotting, learning to customize plot, subplot
%in order to plot we need th plot() function

x = sort(rand(1,25)*100); %makes a random one by 25 row vector from 0 to 100
y = x.^2;
y2 = sort(cos(x)*1000);

figure(1) %label figures, allows to plot multiple figures on seperate plots
plot(x,y,'m--')
grid on %Provides a grid, useful for analyzing data
grid minor %same as grid but tinier
title('\it{Title}') %\it means to itilics 
xlabel('X-axis') %labels x-axis
ylabel('Y-axis') %labels y-axis
hold on %allows you to plot on the same figure

plot(x,y2)
legend('line 1','line 2')

figure(2)
plot(x,y2)
hold on
plot(x,y,'m--')
grid on %Provides a grid, useeful for analyzing data
grid minor %same as grid but tinier
title('\it{Title}') %\it means to itilics 
xlabel('X-axis') %labels x-axis
ylabel('Y-axis') %labels y-axis
plot(x,y2-1000)
plot(x,sin(y2))

%Subplotting 
%allows you to plot different figures on one figure
%Use function subplot()

figure(3)

subplot(2,1,1)
plot(x,y,'m--') %x and y must be the same length
grid on %Provides a grid, useful for analyzing data
grid minor %same as grid but tinier
title('\it{Title}') %\it means to itilics 
xlabel('X-axis') %labels x-axis
ylabel('Y-axis') %labels y-axis
hold on %allows you to plot on the same figure

plot(x,y2)
legend('line 1','line 2')

subplot(2,1,2)
plot(x,y2)
hold on
plot(x,y,'m--')
grid on %Provides a grid, useeful for analyzing data
grid minor %same as grid but tinier
title('\it{Title}') %\it means to itilics 
xlabel('X-axis') %labels x-axis
ylabel('Y-axis') %labels y-axis
plot(x,y2-1000)
plot(x,sin(y2))


