Line and Scatter in MATLAB®

How to make a Line and Scatter graphs in MATLAB®.


x = linspace(0,4*pi,10);
A = 2, B = 3, C = 1;

y = A * x.^2 + B * x + C;

p = polyfit(x,y,2);

k = polyval(p,x);

fig = figure;
hold on
plot(x,y,'ro')
plot(x,k,'b-')
hold off

fig2plotly(fig, 'strip',false);
D = [0 4 8 12 16 20 24 28 32];
F = [0 .23 .36 .43 .52 .64 .78 .85 .92];  
plot(D,F,'.b')
p = polyfit(D,F,1);
f = polyval(p,D);
hold on
plot(D,f,'--r')

fig2plotly();

load gas
fig = figure;
qqplot(price1,price2);
title('Quantile Quantile Plot with two distributions')

fig2plotly(fig, 'strip', false)
x = linspace(1,10,10);
y = randi(10,1,10);

x1 = linspace(1,2*pi, 100);

fig = figure;
hold on
plot(x,y)
plot([1 10],[5 5])
plot([-5 5],[1 10])
plot(x1, sin(x1))
plot(x1, exp(x1))
xlim([-6 10])
ylim([-10 10])
hold off;

fig2plotly(fig, 'strip', false)
x = 1:1:100; 
y = randi(100,1,100);
fig = figure;
hold on
scatter(x,y);
plot(x+2,y)
hold off

fig2plotly(fig)