%
%  Math 340 * Victor Matveev * April 20, 2012
%  See solution to homework #10 for details
%
%  dY
%  -- = Y * (1 - Y)
%  dx
%

y0 = 0.1;
subplot(122);
hold on;
set(gca,'fontsize',12);

f = @(t,y) y(1) .* (1 - y(1));
[T, Y] = ode45(f, [0 10], [y0]);  % Find numerical solution

plot(T, Y(:,1), 'r-', 'linewidth', 2); % Plot the numerical solution
axis tight;

xlabel('x'); ylabel('Y(x)');
title('dY/dx = Y (1 - Y);  Y(0)=0.1');

subplot(121);
hold on;
set(gca,'fontsize',12);
xx = linspace(0,1.5,80);
plot(xx, xx.*(1-xx), 'k-', 'linewidth', 2);
plot([0 1.5], [0 0], 'k--');
plot([0 1], [0 0], 'ok', 'markerfacecolor', [0 0 0], 'markersize', 6);
plot(y0, 0, 'or', 'markerfacecolor', [1 0 0], 'markersize', 6);
xlabel('Y'); ylabel('dY/dx');
title('Rate of change of Y vs. Y');
axis tight;


