% eda02_11
% load and plot neuse.txt dataset

% load data
D=load('neuse.txt');
t=D(:,1);
d=D(:,2);
Ls=size(d);
L=Ls(1);

figure(1);
clf;

% compute rate
dddt=(d(2:L)-d(1:L-1)) ./ (t(2:L)-t(1:L-1));

% segregate out positive and negative rates
pos = find(dddt>0);
neg = find(dddt<0);

% plot pos rate
subplot(2,1,1);
set(gca,'LineWidth',2);
hold on;
axis xy;
axis( [0 10000 0 5000] );
plot(d(pos),dddt(pos),'k.','LineWidth',2);
title('A) positive rates');
xlabel('discharge');
ylabel('d/dt discharge');

% plot neg rate
subplot(2,1,2);
set(gca,'LineWidth',2);
hold on;
axis xy;
axis( [0 10000 -5000 0] );
plot(d(neg),dddt(neg),'k.','LineWidth',2);
title('B) negative rates');
xlabel('discharge');
ylabel('d/dt discharge');


