% Script plots
% Illustrates: array operations in the context of plotting
% open multiple figure windows
% plot multiple graphs using one call to function plot

close all % Close all currently open figure windows

% Plot f(x) = (.2*x^3 - x) ./ (2 + cos(x)) across [-2*pi,2*pi]
x= linspace(-2*pi,2*pi,200);
y= (.2*x.^3 - x)./(1.1 + cos(x));
plot(x,y,'*r')

figure % open new figure window
plot(x(1:100),y(1:100),':k', x(50:200),y(50:200),'xb')
xlabel('x')
ylabel('f(x)')
title('f(x) = (.2*x^3 - x) ./ (2 + cos(x))')