% MATHPRO is very useful for making scientific and engineering plots.
% You can create plots of known, analytical functions,
% you can plot data such as experimental measurements,
% you can analyze data, perhaps by fitting it to a curve,
% and then plot a comparison.
x = [0, 2, 5, 10, 20]; % define x vector
y = [1, 7, 46, 191, 781]; % define y vector
% Plot the datapoints given by vectors x and y
% using plot and colored symbols.
% Calculate the polynomial regression using polyfit,
% and plot the polynom in the same graph.
% generates the coefficients of a second degree polynomial best characterizing the data set
coefficients = polyfit(x,y,2);
% estimate y at x
% generates a new values (estimate) of y based on the coefficients found with polyfit
yp = polyval(coefficients,x);
% plot y (symbol (+) color: red) and yp (line color: blue) versus x
plot(x,y,'+r',x,yp,'b');