% Illustrating 2D plot

clear;clc;close all;

% Use 'plot' command to generate 2D plot
x = linspace(0, 4*pi, 10); 
y = x.^2.*sin(x);

% start a brand new feature
figure;
plot(x, y, 'm-', 'LineWidth', 3);
hold on;
plot(x, y, "m^", 'MarkerSize', 14, 'LineWidth',3);
xlabel('x (seconds)');
ylabel('y = x^2*sin(x)');
grid on;
title('x vs. t, an example plot');
legend('y', 'y (data points)', 'Location','southwest');
axis([min(x), max(x) min(y) max(y)])
text(2, -40, 'The angle of the wheel \theta', 'Color', 'red', 'FontSize',16);

% histogram
N = 2000;
NumBins = 20;

samplesUniform = rand(1, N);
samplesNormal = randn(1, N);

figure;
subplot(2,1,1);
histogram(samplesUniform, NumBins);

subplot(2,1,2);
histogram(samplesNormal, NumBins);

% yyaxis
x2 = linspace(0, 5*pi, 20);
y2 = x2.^3.*sin(x2);

figure
hold on;
yyaxis('left');
plot(x, y, 'r', 'LineWidth', 2);
yyaxis('right');
plot(x2,y2, 'b--');
grid on;

% semilogx
figure;
semilogx(x2, y2);
grid on;

% pi
sales = [15 50 30 30 20];

figure
pie(sales);

% scatter
figure;
subplot(2,1,1);
scatter(x,y);
grid on;

subplot(2,1,2);
plot(x, y, 'b+')
grid on;













