%% Problem 3

%% (a) with ezplot
ezplot('x^3-x',[-1.5,1.5])

%% (a) with plot
x = linspace(-1.5,1.5,50);  % can also use  x = -1.5:.1:1.5;
                            % don't forget semicolon
plot(x,x.^3-x)              % we need .* ./ .^ for vectors

%% (b) with ezplot
ezplot('tan(x)',[-2*pi,2*pi])

%% (b) with plot
% Here we use the axis command to restrict the y-range to -5,5
x = linspace(-2*pi,2*pi,100);
plot(x,tan(x))
axis([-2*pi,2*pi,-5,5]) 

%% (c) 
% We take the left hand side minus the right hand side, then
% ezplot plots all points in the (x,y) plane where this is zero.
ezplot('y^2-x^3+x',[-2.5,2.5])

